user874615
user874615

Reputation: 103

Regex working in C# but not in javascript

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.

Upvotes: 0

Views: 141

Answers (1)

fge
fge

Reputation: 121702

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]).

Upvotes: 1

Related Questions