REReplace(htmlString, "<img[ ].*?[ ]alt="([^"]*)".*>", "\1", "all")

Twiddle, fiddled and meddled for my own education can came up with :

<img [.* ]?alt="([^"]*)".*>

Not a whole lot different from the one Paul created I know, but when I tested Paul's it didn't quite work - no idea why.

If I've got this right it looks for :
1) a string beginning with '<img '
2) followed by an optional number of characters
3) followed by 'alt="'
4) captures any characters that aren't a double quote (into back reference one - \1)
5) followed by a double quote
6) followed by any number of characters and a '>'


So if you take Paul's REReplace and put that regex in, it should spit out the contents of the alt tags.


Does anyone have a regex that will strip all image tags from html but leave the contents of the alt tag.

What are you after exactly??

Sorry about that before - my brain blocked out the word "alt" so all I read was "the contents of the tag"


Regards

Stephen
PS. http://catless.ncl.ac.uk/csc268/regex.php - Great place for testing your regex.



-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
     *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
          *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Reply via email to