regex: colon screwing up my pattern?

D

Darrel

I'm trying to write a regex to strip out all attributes of a tag. For
instance, I have this to strip out all attributes in a TD tag:

(<td)(([^/>].)?|\n)*

If I run it againt:

<td>
<td nowrap>
<td class="monkey">

it works (the first group grabs the opening bracket and tag name, the secong
grabs everything up to the closing bracket)

However, it fails if the tag has a colon in it:

<td x:str>

The above will return this match:
<td x:str>

On closer inspection, ANY stray punctuation in the tag will do this UNLESS
said punctuation is quoted. This works fine:

<td style="monkey: true;">

anyone know why an unquoted punctuation mark isn't matching?

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top