This javascript code:
var regex = /(?<=<img src=").*?(?=")/gm;
var src = regex.match(str);
Gives me this error:
SyntaxError: invalid quantifier ?<=<img src=").*?(?=")
in eval() line 0
What is the problem?
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.
You need to escape your question marks like so:
EDIT:
The above fixes your “invalid quantifier” problem. But, as @Pointy points out in his comment,
RegExpobjects contain nomatchfunction. You’re likely looking formatchon a string. (e.g.,"string".match(/reg(exp)/);).