```
        dataValidation = "min:7 max:20 alphanumeric required";
        var params = [];
        dataValidation.replace(/([^\s]+).?/g, function(a, b){
             var split = b.split(':');
             if (split[1])
                params.push([split[0]] = split[1]);
             else
                params.push([split[0]] = true);
              return
            });

```

My code, i want to create array of objects, with keys and values, split[0] and split[1], but the result for this is something like that

> 
> ["7", "20", true, true]
> 
> 
> 

instead of 

> 
> [{min:7}, {max:20}...].
> 
> 
> 

Also im not sure that creating function inside replace is best way to do it.