Regular expression to match text outside html tags and not between specific tag

后端 未结 1 539
庸人自扰
庸人自扰 2021-01-24 00:42

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 h

相关标签:
1条回答
  • 2021-01-24 01:05

    use this pattern to skip/ fail everything between <h1></h1>
    Updated per comment below

    <h1>[^<>]*<\/h1>(*SKIP)(*F)|(\bsample|text\b)(?=[^>]*(?:<|$))  
    

    Demo

    0 讨论(0)
提交回复
热议问题