Regex for quoted string with escaping quotes
问题 How do I get the substring \" It\'s big \\\"problem \" using a regular expression? s = \' function(){ return \" It\\\'s big \\\"problem \"; }\'; 回答1: /"(?:[^"\\]|\\.)*"/ Works in The Regex Coach and PCRE Workbench. Example of test in JavaScript: var s = ' function(){ return " Is big \\"problem\\", \\no? "; }'; var m = s.match(/"(?:[^"\\]|\\.)*"/); if (m != null) alert(m); 回答2: This one comes from nanorc.sample available in many linux distros. It is used for syntax highlighting of C style