Ricky
Ricky

Reputation: 7

Regular Expression to exclude a string?

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:

<title>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

Upvotes: 0

Views: 639

Answers (1)

Snekse
Snekse

Reputation: 15799

A basic look around would probably handle that.

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

Upvotes: 1

Related Questions