"([\"'])(?:\\\\?+.)*?\\1"
I came up to this regexp to match all quoted strings.. It seems to work great... The problem is how to match the text that isnt inside quotes.. The inverse -negative somehow...
我来到这个正则表达式匹配所有引用的字符串..它似乎工作得很好...问题是如何匹配不在引号内的文本..逆 - 负某种方式...
I read the documentation and
我阅读了文档和
(?!(([\"'])(?:\\\\?+.)*?\\1))
doesnt work
1 个解决方案
#1
6
Hmm If the first regular experssion works, I would use it to remove all quoted strings from the input string. Then, all you will be left with is the text that was outside quoted strings. With certain types of patterns, I find this approach much easier and simpler.
嗯如果第一个常规experssion工作,我会用它从输入字符串中删除所有引用的字符串。然后,您将留下的所有内容都是引用字符串之外的文本。对于某些类型的模式,我发现这种方法更容易和更简单。
#1
6
Hmm If the first regular experssion works, I would use it to remove all quoted strings from the input string. Then, all you will be left with is the text that was outside quoted strings. With certain types of patterns, I find this approach much easier and simpler.
嗯如果第一个常规experssion工作,我会用它从输入字符串中删除所有引用的字符串。然后,您将留下的所有内容都是引用字符串之外的文本。对于某些类型的模式,我发现这种方法更容易和更简单。