I know I can use named subpatterns in preg_match to name the row in my array: (?P<sval1>[\w-]+). The problem I have with this is that “sval1” is predefined. Is it possible to make this named subpattern as part of the regex lookup itself?
For instance, if the text field is as follows:
step=5
min=0
max=100
I would like to use a preg_match to create an array with essentially:
{
[step] => 5
[min] => 0
[max] => 100
}
The user would be able to add as many fields as they want to the text entry; so it needs to dynamically generate the array entries based on their input. Is there an easy way to do this?
or:
or based on the comments: