Anyone help? When I run this I get ” invalid quantifier ?<=href= “
var aHrefMatch = new RegExp("(?<=href\=")[^]+?(?=")");
var matchedLink = mystring.match(aHrefMatch);
But I know the regular expression is valid.
Any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Javascript does not support lookbehind assertions. It only supports lookahead ones. The error is produced because it assumes the ? is a quantifier for 0 or 1, but there is no element to quantify at the beginning of a subpattern (started by that
(opening parenthesis)Also, your string seems to be missing a few backslashes, as the double quotes are not escaped there. It should produce a syntax error.
Perhaps this code could help you do what you are trying to achieve: