在字符串中查找字符串

阿伦·伍斯特(Aron Woost)

我有以下字符串:

here "is 'a' \"string\" that" does contain a 'lot of "weird"' stuff "i" to 'find'

我想提取is 'a' \"string\" thatlot of "weird"ifind

有任何想法吗?谢谢!

阿努巴瓦

基于负向后的正则表达式应该为您工作:

/(["']).*?(?<!\\)\1/g

现场演示:http//www.rubular.com/r/X3etmgKFNH

不支持后向的正则表达式,例如Javascript

/(['"])(?:\1|.*?[^\\]\1)/g

现场演示:http//www.rubular.com/r/SQyEYIPS4l

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章