Jump to content

Regexp Help In Js


skaterdav85

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...