Helpful Information
Home
Categories
Contact us
Category: Regex Programming
Help with creating a regex
hi all, I am in need of a regex to parse a few strings for a script i'm writing in PHP.
My data looks like this (it will be in a string)
var talentsTreeArray=new Array;
talentsTreeArray[0]=[1, 50, "example1"];
talentsTreeArray[1]=[2, 19, "example2"];
talentsTreeArray[2]=[3, 0, "example3"];
I need to extract the 2nd number (50,19, and 0) and the string in the quotes.
thanks in advance! :tntworth:
So use
"talentsTreeArray[" + digits + "]=[" + digits + ", " + digits
Capture the last bunch of digits.
Remember to escape the []s, \d represents digits, and that you surround stuff you want with parentheses.
privacy (GDPR)