S
SpideyPKT
Help!
I'm trying to create a regex and I can't quite seem to get it right...
I'm trying to get several arguments out of a string which looks like:
args=['arg #1']
or
args=['arg #1', 'arg #2', 'arg #3']
I'd like to be able access the arguments via something like:
for(int i=1; i <= m.groupCount(); i++)
arg = m.group(i);
The closest pattern I've gotten is:
"args=\\[(?:\'(.*?)\',)*\\s*\'(.+)\'\\]"
My problem is that for a single argument, I get arg[1] = null and
arg[2] = "arg #1" and for 3 or more arguments i get arg[1] = arg #1 and
arg[2] = arg #2' , 'arg #3 so it has something to do with it greedily
grabbing the rest of the characters.
Any ideas???
Thanks in advance!
Brian
I'm trying to create a regex and I can't quite seem to get it right...
I'm trying to get several arguments out of a string which looks like:
args=['arg #1']
or
args=['arg #1', 'arg #2', 'arg #3']
I'd like to be able access the arguments via something like:
for(int i=1; i <= m.groupCount(); i++)
arg = m.group(i);
The closest pattern I've gotten is:
"args=\\[(?:\'(.*?)\',)*\\s*\'(.+)\'\\]"
My problem is that for a single argument, I get arg[1] = null and
arg[2] = "arg #1" and for 3 or more arguments i get arg[1] = arg #1 and
arg[2] = arg #2' , 'arg #3 so it has something to do with it greedily
grabbing the rest of the characters.
Any ideas???
Thanks in advance!
Brian