Menu
I was recently parsing SVG data using JavaScript String.match, and came across a problem. I was taking out coordinates to use them in a canvas application, and tried to do this:
[code]
var r = /[mc][B]([+-]?d+(.d+)?,?)[/B]+/i;
“m12.6-52.1”.match(r);
As it’s supposed to, this just matches the last capture of the bolded group, so, just -52.1 is returned. I can’t think of an easy way around this, so I wondered if anyone else has one.
If not, I’ll probably end up leaving the regular expressions and using normal string methods to parse it, but I’d really like to use regular expressions.