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