function ReplaceURLs(ByVal strToFormat) dim oTag,c1Tag,oTag2,c2Tag,roTag,rc1Tag,rc2Tag,rc3Tag,oTagPos,c1TagPos,oTagPos2,c1TagPos2,Counter,strArray,strArray2,strFirstPart,strSecondPart,arrWRT oTag="[url=""" c1Tag="""]" oTag2="[url]" c2Tag="[/url]" roTag="" rc2Tag="" rc3Tag=""">" oTagPos=instr(1,strToFormat,oTag,1) c1TagPos=instr(1,strToFormat,c1Tag,1) if oTagpos>0 and c1TagPos>0 then strArray=split(strToFormat,oTag,-1,1) for Counter=0 to ubound(strArray) if instr(1,strArray(Counter),c1Tag,1)>0 then strArray2=split(strArray(Counter),c1Tag,-1,1) strArray2(0)=replace(strArray2(0),Chr(34)," ") arrWRT=array(";","+","(",")","*","'",">","<",vbtab,"view-source","javascript","jscript","vbscript") for x=0 to ubound(arrWRT) strArray2(0)=replace(strArray2(0),arrWRT(x)," ",1,-1,1) next if instr(1,strArray2(1),c2Tag,1) and not instr(1,ucase(strArray2(1)),"[URL]",1) then strFirstPart=left(strArray2(1),instr(1,strArray2(1),c2Tag,1)-1) strSecondPart=right(strArray2(1),(len(strArray2(1))-instr(1,strArray2(1),c2Tag,1)-len(c2Tag)+1)) if len(strFirstPart)>0 then if instr(ucase(strArray2(0)),"WOO.IE")>0 then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strFirstPart,5))="[IMG]" then ReplaceURLs=ReplaceURLs&""&strFirstPart&""&strSecondPart elseif ucase(left(strArray2(0),7))="HTTP://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),8))="HTTPS://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),4))="WWW." then ReplaceURLs=ReplaceURLs&roTag&"http://"&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),7))="MAILTO:" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),6))="FTP://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif instr(strArray2(0),"@")>0 then ReplaceURLs=ReplaceURLs&roTag&"mailto:"&strArray2(0)&rc3Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),8))="FILE:///" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart else ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strFirstPart&rc2Tag&strSecondPart end if end if else if instr(ucase(strArray2(0)),"WOO.IE")>0 or (ucase(left(strArray2(0),7))<>"HTTP://" and ucase(left(strArray2(0),8))<>"HTTPS://" and ucase(left(strArray2(0),4))<>"WWW." and ucase(left(strArray2(0),6))<>"FTP://" and ucase(left(strArray2(0),8))<>"FILE:///")then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strArray2(0)&rc2Tag&strArray2(1) else ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strArray2(0)&rc2Tag&strArray2(1) end if end if else ReplaceURLs=ReplaceURLs&strArray(Counter) end if next else ReplaceURLs=strToFormat end if oTagPos2=instr(1,ReplaceURLs,oTag2,1) c1TagPos2=instr(1,ReplaceURLs,c2Tag,1) if oTagpos2>0 and c1TagPos2>0 then strArray=split(ReplaceURLs,oTag2,-1,1) ReplaceURLs="" for Counter=0 to ubound(strArray) if instr(1,strArray(Counter),c2Tag,1)>0 then strArray2=split(strArray(Counter),c2Tag,-1,1) arrWRT=array(chr(34),";","+","(",")","*","'",">","<",vbtab,"view-source","javascript","jscript","vbscript") for x=0 to ubound(arrWRT) strArray2(0)=replace(strArray2(0),arrWRT(x)," ",1,-1,1) next if instr(ucase(strArray2(0)),"WOO.IE")>0 or (ucase(left(strArray2(0),7))<>"HTTP://" and ucase(left(strArray2(0),8))<>"HTTPS://" and ucase(left(strArray2(0),4))<>"WWW." and ucase(left(strArray2(0),6))<>"FTP://" and ucase(left(strArray2(0),8))<>"FILE:///")then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strArray2(0)&rc2Tag&strArray2(1) else ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strArray2(0)&rc2Tag&strArray2(1) end if else ReplaceURLs=ReplaceURLs&strArray(Counter) end if next end if end function