The main problem is that you are trying to use a character expression when
you need to match a multicharter expression. I would probably do this in
multiple passes.
In the first pass do say:

 st=rereplacenocase(st,'src="http://','src="|","all");
this will replace all http with a  | symbol ( if you use pipes in page then
think of a different single character)

Now we know that all the ones with http  have pipe

second pass  we want to take those without pipe or a slash  and add a slash
st=rereplacenocase(st,'<IMG alt="" src="([^|/])','<IMG alt=""
src="/(\1)',"all");

and finally replace the | with http://
st=rereplacenocase(st,'src="|','src="http://","all";)

A couple of complications:  what about https://
What happens if they reverse src and alt or add extra spaces.



----- Original Message -----
From: "Bernd VanSkiver" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, December 13, 2001 3:21 PM
Subject: RegEx Help


> Got a Regular Expression problem that I can't figure out how to solve.
> Below are two possible strings that could be send to my replace function.
> The order of the atributes could be in any order and the domain name and
> file name will also be different in each case.
>
> <IMG alt="" src="aboutuson.jpg" border=0>
> <IMG alt="" src="http://www.domain.com/aboutuson.jpg"; border=0>
>
> What I need to do is files that don't have a absolute web path with the
> "http://"; need something like the following prepended to them: "/images/"
so
> the results of the above would be as follows.
>
> <IMG alt="" src="/images/aboutuson.jpg" border=0>
> <IMG alt="" src="http://www.domain.com/aboutuson.jpg"; border=0>
>
> Here is the regular expression that I was using, but it doesn't work
right.
>
> REReplace('<IMG alt="" src="aboutuson.jpg" border=0>',
> "src=#Chr(34)#[^http://]";, "src=#Chr(34)#/images/", "ALL")
>
> What I get when I do that is as follows:
>
> <IMG alt="" src="/images/boutuson.jpg" border=0>
>
> It is stripping the first letter off the file name.  Does anyone have an
> idea how I can get this to work correctly?  I can't figure out the correct
> syntax to get it to do what I want.
>
> Bernd VanSkiver
> [EMAIL PROTECTED]
> ColdFusion Developer
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to