Regular Expression find a phrase not inside an HTML tag

Posted by James Buckingham on Stack Overflow See other posts from Stack Overflow or by James Buckingham
Published on 2010-05-05T14:25:30Z Indexed on 2010/05/05 14:28 UTC
Read the original article Hit count: 271

Filed under:
|

Hi there,

I'm struggling a bit with this regular expression and wondered if anyone was about to help me please?

What I need to do is isolate the 1st phrase inside a string which is NOT inside an HTML tag. So the examples I have at the moment are:

This is some test text about ITS for the ITS department. Also worth mentioning ABS as well I guess.ITS,

... and ...

This is some ITS test text about ITS for the ITS department. Also worth mentioning ABS as well I guess

So in the first example I want it to ignore the wrapped ITS and give me the ITS at the end of the 1st sentence.

In the second example I want it to return the ITS at the start of the 2nd sentence.

The aim is to replace these with my own custom wrapped acronym tags in a ColdFusion application I'm writing.

Thanks a lot, James

© Stack Overflow or respective owner

Related posts about regex

Related posts about coldfusion