1
var search = new RegExp("<span class=\"highlight\">(?<text>.*)</span>", "g");

Is there something wrong with the RegEx? Firebug just says "invalid quantifier". Thats it, no more information.

1 Answer 1

1

The question mark quantifier is wrong there. You want to match and collect between the brackets (). Doing (? is wrong, if you want to match ( you should escape the brackets.

var search = new RegExp("<span class=\"highlight\">(<text>.*)</span>", "g");

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

2 Comments

I'm pretty sure the (?<text>.*) was supposed to be a named group, which isn't supported by JavaScript regexes. The equivalent non-named group would be (.*).
@Alan Moore: Yeah, it was. I used the non-named group instead.

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.