Example #1
0
func parseArrayForm(r url.Values) map[string]map[string]map[string][]string {
	dblarr := make(map[string]map[string]map[string][]string)
	for key, val := range r {
		res, err := regexp.MatchString(`([\w\d])+(\[([\w\d])+\])(\[([\w\d])+\])`, key)
		if err != nil {
			log.Println(err)
		}
		if res {
			r := regexp.MustCompile(`([\w\d])+`)
			a := r.FindAllString(key, 3)
			if dblarr[a[0]] == nil {
				dblarr[a[0]] = make(map[string]map[string][]string)
			}
			if dblarr[a[0]][a[1]] == nil {
				dblarr[a[0]][a[1]] = make(map[string][]string)
			}
			dblarr[a[0]][a[1]][a[2]] = val
		}
	}
	return dblarr
}