in reply to Re: Regex to "wrap" a <span around an image.
in thread Regex to "wrap" a <span around an image.

You know that your regex will fail?

Example HTML code snippet:

<img src="greater.gif" alt=">">

Yes, it's not nice to put an unescaped > there, but it's legal and I see it more than often when dealing with jsf and woodstock tag library.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^3: Regex to "wrap" a <span around an image.
by monarch (Priest) on Dec 01, 2008 at 23:58 UTC
    Ah never saw that before. Thanks for pointing that one out! Technically shouldn't that be encoded as <img src="..." alt="&gt;">? I think you'll find my solution shouldn't fail unless you use data from people determined to make your life miserable.

      Sure I know. I use that regexp more than once in a while. But Sun is determined to make my life miserable ;-) (just kidding)


      s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
      +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e