tags:

views:

40

answers:

1

Hi,

I am having trouble fabricating a Regex which will returns tags that are not self-closing. So I would want it to returns tags which are like so:

<blah>

But not tags which are like:

<blah/>

I have the following regex:

<(o|p)(.*?)>

Which is slightly simplified, ignore the rest it does what it is meant to do despite it's oddness. This will match all tags though while I need one that will ignore matches where the tag is self-closing.

Cheers

+1  A: 

Try this regular expression:

<(?:o|p)(?:[^"'>/]+|"[^"]*"|'[^']*')*>

Valid XHTML syntax is presumed.

Gumbo
Cheers! That did it :)
Damien