skaterdav85 Posted September 29, 2011 Share Posted September 29, 2011 I've created a regular expression using a positive lookbehind and I've tested it on this RE test site: http://gskinner.com/RegExr/ It's valid and it works, but when I try and create a regexp object in JS using that same expression, I get an error. var re = /(?<=beans.\sTotal\s=\s)[0-9]*/g; Chrome Console Error: Uncaught SyntaxError: Invalid regular expression: /(?<=beans.\sTotal\s=\s)[0-9]*/: Invalid groupJS Bin Error: Line 1: var re = /(?<=beans.\sTotal\s=\s)[0-9]*/g; --- Expected ':' and instead saw '<'. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 29, 2011 Share Posted September 29, 2011 That test site runs the expressions in Actionscript, not Javascript. http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.