0

Can anyone help getting a piece of regex working in javascript please?

This is the regular expression:

storify.com\/*(?<code>[^"]*)

It works fine in C# but I can't get it working in js, I presume due to a delimiter issue but not sure which characters are causing the problem.

This is the js I'm trying but gives me and an "invalid quanitifier" error on the first line

var myregex = /storify.com\/*(?<code>[^"]*)/;
var storify = 'http://storify.com/DigitalFirst/ces-2013-five-things-you-missed-day-3';
var remoteid = storify.match(myregex);
console.log(remoteid);

Thanks in advance for anyone who can help get this working.

2
  • You should escape the .. Also, you probably want .*, not /*. Commented Jan 10, 2013 at 17:38
  • Could you post your C# code? Commented Jan 10, 2013 at 18:35

1 Answer 1

1

JavaScript regexes have no suport for named captures (?<xxx>...), that is why.

More details here (note: JavaScript is referred to as ECMA [262, to be precise]).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.