<img[^>]+([a-z0-9_]\.(?:jpg|jpeg|gif|png))[^>]*> <img - start of the match [^>]+ - everything until a closing bracket [a-z0-9_]\.(?:jpg|jpeg|gif|png) - any number of alphanumeric characters or an underscore followed by a period followed by a valid image extension [^>]*> - any number of characters until the closing bracket
The match will be stored in \1 It's not perfect but it works. On 6/15/07, Jide Aliu <[EMAIL PROTECTED]> wrote: > > I posted questions to the talk section yesterday and you guys have been > great help. > > I'm trying to replace all instance of image tags e.g <img alt="" > height="158" src="/uploads/Image/BlissStarWars_15.jpg" width="210"/> with > the following tag > <ContentItem Href="BlissStarWars_15.jpg" Duid="hardcoded"> > <Comment>hardcoded</Comment> > <MediaType FormalName=""/> > <Format FormalName=""/> > </ContentItem> > At the moment the regular expression below fills in the Href attribute in > the ContentItem tag. > <cfset content = rereplace(dataContent, > "<img([^src]*)(src=['|""])([/*[[:alnum:]]*/]*)([^""]*)[^>]*>", "<contentItem > Href=""\4""><Comment>hardcoded</Comment> > <MediaTypeFormalName=""hardcoded""/> <Format FormalName=""the Format type > .ext type is supposed to be in here""/><contentitem>", "all")> > > What I want to also achieve is get the extension "jpg" from filename and > stick it in the Format tag inside the attribute FormalName is this at all > possible? > > Many thanks, > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1043 Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
