Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strings 1

Status
Not open for further replies.

scottRen

Technical User
Feb 4, 2005
69
CA
hi i have an html page as a string and in the string there are:
Code:
<a target="_self" href="/Archives/page/test/1234026/000123402605000004/0001234026-05-000004-index.htm">[html]</a>

the string contains dynamic html so i never really know where the hyperlinks will appear. I was wonder how it can be so that each href="/ in the string is replaced with: href="
thanks,

scott the newbie
 
or maybe a RegEx:
Set regex = new RegExp
regex.ignorecase=true
regex.global=true
regex.pattern="href=(['""])/[^\1]+\1"
TheString="<a target=""_self"" href=""/Archives/page/test/1234026/000123402605000004/0001234026-05-000004-index.htm"">
HTML:
</a>"
	TheString=RegEx.replace(TheString,"href=$1[URL unfurl="true"]http://www.company.com/$1")[/URL]
	response.write TheString


Known is handfull, Unknown is worldfull
 
thanks guys, one issue though is that i don't know how many href i have in the string, since the string is gathered from dynamic data, so how could i do a replace for every instance of href="/ to href="
thanks
 
no problemmo...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top