繁体   English   中英

正则表达式-忽略Word + HTML内部

[英]Regex - ignore inside word + html

尝试从以下有限的正则表达式知识中选择“内容”一词(使用javascript):

 Here is content <p>content</p> content. Content contentpeople peoplecontent peoplecontentpeople 
使用正则表达式:

 ([\\S]*)content([\\S]*) 
这使我“满意”而没有空格,但同时又带回了P标记和“ peoplecontent”-我只希望它不是另一个单词的一部分。 我需要将一些NOT链接在一起,对吗?

使用\\b ,即单词边界元字符,

/\bcontent\b/g

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM