Yes! that helps alot, its deffinatley alot closer than ive gotten it, but your example misses its own first 4 img tags in the test string. Any thoughts?
----- Original Message ----- From: "Jerry Johnson" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, July 29, 2003 9:08 AM Subject: Re: Attention Regex guru's > <cfset str="dkl gljk <img > slkgaj ljk <img border=0 src=jj.gif title=""""> sklgj jl <img src=""jj.gif"" border=0> slgkj <img src=""jjj.gif"">sldk jgljks d <img src=""somwhere/images/image.gif"" alt=""im alt text"" width=""100"" height=""100""> sfg as g or <img src=""image.gif""> or <img src=""http://site.com/images/image.gif"" alt=""im alt text"" width=""100"" height=""100""> or as Kola pointed out.. < img src=""somwhere/images/image.gif"" alt=""im alt text"" width=""100"" height=""100"" >"> > > <cfset imgfilename="image.gif"> > > > <cfset bb=rereplacenocase(str,"<[^>]*img[^>]+src=""?[^"" ]*#imgfilename#""?[^>]*>", "<IMG>","ALL")> > > <hr> > <cfoutput>#str#</cfoutput> > <hr> > <cfoutput>#bb#</cfoutput> > <hr> > > This handles all the cases you included. REFindNoCase should be the same regex. > > > Does this help? Am I still missing it? > Jerry Johnson > > > >>> [EMAIL PROTECTED] 07/29/03 02:56PM >>> > mail must be wiggin out again... i havent seen another response from > jerry... > ok I dont think i explained it too well... > > basically we made the mistake that alot of people have, giving a client a > textarea in an admin tool to edit the main body of a certain page. Now we > also gave a pretty descent dynamic image placement feature so they can place > an image where ever they want in the body. > > Well, they decided (for some reason or another) to not use the image > placement tool and put in their own image tags. This all works fine as long > as the put it in right.... until... they go into the image management tools > and delete an image they have put in manually. THen they are left with a > broken image unless they go to that admin tool as well and remove the no > longer valid image tag. > > so... what im trying to do is this... > > when they go to the image manger tool for say the news section... and delete > an image > I want to search the news table's body content filed and remove any image > tag that has the image that is being deleted in it > > so i might be looking for > <img src="somwhere/images/image.gif" alt="im alt text" width="100" > height="100"> > or > <img src="image.gif"> > or > <img src="http://site.com/images/image.gif" alt="im alt text" width="100" > height="100"> > > or as Kola pointed out.. > > < img src="somwhere/images/image.gif" alt="im alt text" width="100" > height="100" > > > all of these may or may not have double quotes or single quotes > the only thing known for certain going in is that it is going to > START with a "<" > CONTAIN somewhere within a "img" and the name of the image "image.gif" > END with a ">" > > so i need to match (somehow) "<" + possibletext + "img" + > possibletextandslashes + #imagename# + more possibletext + ">" > > hope this all makes sense : ) > > > ----- Original Message ----- > From: "Jerry Johnson" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Tuesday, July 29, 2003 7:52 AM > Subject: Re: Attention Regex guru's > > > > The previous response is much better (since I read your question partly > wrong) > > > > It only allows 0 or 1 quotes after src= (mine allowed for more for no > good reason) > > It looks for the #imgfilename# string (mine looked for an actual > filename set by imgfilename) > > It doesn't bother finding the quotes after the src= (since it is not > important) > > > > Jerry Johnson > > > > >>> [EMAIL PROTECTED] 07/29/03 10:44AM >>> > > <snip> > > Jerry Johnson > > > > > > >>> [EMAIL PROTECTED] 07/29/03 01:28PM >>> > > I've come to the conclusion that ...I suck at Regular axpressions..... > > I've been trying to get a regex to match all instances of > > > > start somewhere in there end > > "<img=" "#imagefilename#" ">" > > > > since there can be width, height, alt, etc... I need everything that > starts > > with "<img" and ends with ">" and has "#imagefilename#" name inbetween. > Make > > sense? > > > > i figured id go with #imagefilename# rather than "src=#imgfilename#" since > > ive seen some with quotes and some without > > > > > > any help greatly appreciated thanks > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

