[英]Regular expression to match text outside html tags and not between specific tag
I trying to get a regular expression to match some words outside and between html tags (and not in tags themselves), but I also need to exclude them when they are between html heading tags (h1, h2, h3, etc...) 我试图获取一个正则表达式以匹配html标签外部和之间的某些单词(而不是标签本身),但是当它们位于html标题标签之间(h1,h2,h3等)时,我还需要排除它们
Here is what i tried: /(\\bword\\b)(?=[^>]*(<|$))/i
这是我尝试的:
/(\\bword\\b)(?=[^>]*(<|$))/i
Live example: https://regex101.com/r/rM8tU3/1 实时示例: https : //regex101.com/r/rM8tU3/1
Excluding heading tags is the only element missing. 缺少标题标签是唯一缺少的元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.