Pages

Saturday, August 5, 2006

Can’t use regex as response

Must abuse posting privledge
I think I hold the key to Xavier’s problem

<([^/][^>]*?[^/])>(?!.*?</\1>)

-= Comments
1. Xavier | August 4th, 2006 at 3:45 pm
This will incorrectly match normal tags too though?
Input:blah
Output: blah

2. Xavier | August 4th, 2006 at 3:48 pm
Oh wait, I get it now. It will also match unclosed divs and such, which (I think) I want the parser to do because it closes them properly, where as it closes img tags as if they were divs, which is wrong.

I want it to only match img,input,…whatever I put in my post

3. pimaster | August 4th, 2006 at 10:12 pm

<((?:br)|(?:img)|(?:hr)|(?:script))[^/]*?>

Althought the script one isn’t handled well since sometimes it can be part of a pair, and sometimes it isn’t.

You could try pairing it with the orignal !\1 check, but I had trouble when there were two open scripts and only 1 close script.

No comments:

Post a Comment