正则表达式匹配引号之外的给定单词 [英] Regex match given word outside of quotes

查看:43
本文介绍了正则表达式匹配引号之外的给定单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够在引号之外匹配互联网" 一词.e; g

I need to be able to match the word "internet" outside of quotations. e;g

Internet "InternetFormula works and it's internetformula"
Internet "The internet works"

但是我不知道该怎么做,因为正则表达式很复杂,而且找不到类似的东西.

But I have no idea how to do so as Regular Expressions is complicated, and I can't find anything like it.

推荐答案

\bInternet\b(?=(?:[^"]*"[^"]*")*[^"]*$)

您可以尝试一下.请参见演示.

You can try this.See demo.

https://www.regex101.com/r/fG5pZ8/22

这篇关于正则表达式匹配引号之外的给定单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆