Stephen Moretti (cfmaster) wrote:
Alex Skinner wrote:
Does anyone have a regex that will strip all image tags from html but leave the contents of the alt tag.
Ok... what you have is:
1) opening tag of '<img ' (not ending in a space) plus various things up to...
2) an ' alt="'
3) contents of the tag: anything that isn't a double quote - [^"]* (star as it may be empty!)
4) a closing "
5) the rest and a closing tag - [^>]*>
Basically it's a REReplace... like this (untested):
REReplace(htmlString, "<img[ ].*?[ ]alt="([^"]*)".*>", "\1", "all")
The only thing is that this may not quite work (you'll have to play with it) because of the .*? after the img. It's made non-greedy, so it should work, but it's untested.
Paul
-- 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]
