akrishmohan
Programmer
I have a string that needs to be matched against a regex and if a match occurs return true/ false.
The variable length string to be compared looks like this
20=34x89,10=23:45,12=10:32, and soon. As you can see, the number and order of strings containing x's and :'s are not known.
I wrote this regex and that doesnt seem to be working
var test = [1-9][0-9]*=[0-9]+x[0-9]+" + "|" + "[1-9][0-9]*=([0-5][0-9])[0-5][0-9])";
var pattern = test + (,test)*; //only one token could exist.
when i try to use the patten against the string, i get no match found. Whats wrong in the pattern i created. Any help would be appreciated.
Thanks
K
The variable length string to be compared looks like this
20=34x89,10=23:45,12=10:32, and soon. As you can see, the number and order of strings containing x's and :'s are not known.
I wrote this regex and that doesnt seem to be working
var test = [1-9][0-9]*=[0-9]+x[0-9]+" + "|" + "[1-9][0-9]*=([0-5][0-9])[0-5][0-9])";
var pattern = test + (,test)*; //only one token could exist.
when i try to use the patten against the string, i get no match found. Whats wrong in the pattern i created. Any help would be appreciated.
Thanks
K