开发者

Regular Expression to exclude a string?

开发者 https://www.devze.com 2023-01-18 02:30 出处:网络
I have a regular expression that runs through html tags and grabsvalues. I currently have this to grab all values within thetag.

I have a regular expression that runs through html tags and grabs values. I currently have this to grab all values within the tag.

<title\b[^>]*>(.*\s?)</title>

It works perfectly. So if I have a bunch of pages that have titles:

<tit开发者_如何学运维le>Index</title>

<title>Artwork</title>

<title>Theory</title>

The values returned are: Index, Artwork, Theory

How can I make this regular expression ignore all tags with the value Theory inside them?

Thanks in Advance


A basic look around would probably handle that.

<title\b[^>]*>(((?!Juju - Search Results).)*)(.*\s?)<\/title>
0

精彩评论

暂无评论...
验证码 换一张
取 消