x0n PROMODE

i get pwned every day
posts : 192 administrator ive donated to quake.ie!
    
| killys idea is a good one -- having <a href=url>name</a> functionality is a good one: you can do it in vbscript using regular expressions easy enough; I knocked up some code for ye Eric, this will handle both the new proposed format and the old one, e.g.
[ url ]http://site.com/page.htm[ /url ]
and
[ url=http://site.com/page.htm ]text[ /url ]
----
function processUrlTags(post)
dim re
dim tempStr
set re = new RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "(\[url=([^\]]+)\])(.*?)(\[\/url\])"
tempStr = re.Replace(post, "<a href=""$2"">$3</a>")
re.Pattern = "(\[url\])(.*?)(\[\/url\])"
processUrls = re.Replace(tempStr, "<a href=""$2"">$2</a>")
end function
html = "this is some crap that I want to [ url=http://domain.com/site/page.htm ]link[ /url ] too. this is a second [ url=ftp://test.com/dir/file.exe ]link[ /url ] to something else on an ftp server; here is a third format [ url ]http://test.com/page.htm[ /url ] in the old format."
html = processUrlTags(html)
---
I wanted to do it all in one regex, but unfortunately vbscript aint flexible enough (but server-side java-script would be, but I know yer using vbscript)
Eric, youll need to slightly modify my example since I jammed spaces between [ and url and ] so as not to get parsed by quake.ie itself The regex patterns themselves though havent been munged, only the html variable example.
- Oisin
|