Jump to content

Regexp Help In Js

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 '<'.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...