> Try this:

> '<img[^>]+src="[^"]*#URL.img#"[^>]*>'

> Regex, at least for me, almost always involves a little
> bit of trial and error.

That it does... dropping the [[:space:]] and changing the * to + is a
good thought with regard to fixing this regex. And the extra
[[:space:]] you removed at the end of the attribute is _probably_
unnecessary. It would catch any images which might have white-space
between the file name and the closing quote mark for the attribute,
which could happen, but isn't very likely.

I would save some of your content to a test template, like this:

<cfsavecontent variable="content">
        blah blah
        <img src="yadda/yadda.jpg" />
        blah blah
</cfsavecontent>

and then perform the regex on this variable to save you some time
trying to debug it. This way you also know the regex works independant
of anything else going on in the page. Once you've isolated an
expression that works, then you can implement it in the page.

I'd also recommend applying the regex prior to the cfquery rather than
within the value attribute of the cfqueryparam tag -- this should make
the code more legible when you come back and look at it later, since
you'll only be dealing with one set of double quotes instead of two
with escapes. In general, the less escaping you do in the template imo
the more legible the code will be, so if you can alter your syntax to
avoid the need to escape, that's a win-win situation.


s. isaac dealey     434.293.6201
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236638
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to