简体   繁体   中英

Regex - ignore inside word + html

trying to select the word "content" (using javascript) with my limited regex knowledge from the below:

 Here is content <p>content</p> content. Content contentpeople peoplecontent peoplecontentpeople 
With the regex:

 ([\\S]*)content([\\S]*) 
This gets me "content" without the spaces but is also bringing back the P tag and "peoplecontent" - I only want if its not part of another word. I need to chain some NOTs together right?

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

/\bcontent\b/g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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