I am writing to extract strings which are surrounded by quotes (“). I use the below statement in jquery to get it.
var item = objstr.match(/\"(([^\"])*)\"/g);
But i want to make an exception for \” to be allowed.
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.
This regex might work as well, without using look-aheads or look-behinds: (remove the spaces!)
Read: Match a string from double-quote to double quote. In between there may be nothing or any combination of escaped backslashes
\\, escaped double quotes\"or any non-quote characters. This allows for input liketo be valid, but not
You might want that if your string may have the unescaped meaning
\".The answer from @nickb doesn’t have this feature/bug, whatever you call it. Both strings are valid in his regex.
Should your regex engine be able to turn off backtracking, this is the time to use it. In Perl, I have to add a
+to a quantifier (or turn to esoteric branch resets). I don’t know what you need.We also want greedy behaviour, so no
*?constructs.