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

后端 未结 1 538
庸人自扰
庸人自扰 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


    Updated per comment below

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

    Demo

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