i am getting a url
from cfhttp
page request as:
<a href="http://subdomian.maindomain.com/javascript:popOne('http://www.rs.com ')">http://www.rs.com</a>
i am trying to replace it as:
<a href="http://www.rs.com" target="_blank">http://www.rs.com</a>
the rs.cfm is gonna be dynamic everytime, it can be sb,sd,ge
etc etc
and i want to add a target to the a href
trying it like this
<cfset lnk = replace(cfhttp.filecontent,'subdomian.maindomain.com/http://www.al.com/','http://www.al.com/','ALL')>
this works in one case where the name is al
, but do not add the target attribute to it. also
Something like the following should work. NOTE: I have not tested this code. I will leave that up to you.
Your beginning string is:
You can remove the beginning part by doing something like the following:
This should leave
lnk
set to the following:Now you need to remove the trailing part like so:
Which should leave you with the URL that you want:
Now just create your HTML output as desired:
This sample code assumes that the strings like
subdomain.maindomain.com ...
do not change. If the string is dynamic then this code will not work and will need to be modified to possibly use a regex instead.Putting it all together:
Hope that helps.