%
Function bbcode_format(var)
Set reo = New RegExp
reo.Global = True
srch = array("\[b\](.*?)\[\/b\]", _
"\[i\](.*?)\[\/i\]", _
"\[u\](.*?)\[\/u\]", _
"\[img\](.*?)\[\/img\]", _
"\[url\](.*?)\[\/url\]", _
"\[url\=(.*?)\](.*?)\[\/url\]")
repl = array("$1", _
"$1", _
"$1", _
"
", _
"$1", _
"$2")
res = var
For i = LBound(srch) To UBound(srch)
reo.Pattern = srch(i)
res = reo.Replace(res, repl(i))
Next
Set reo = Nothing
bbcode_format = res
End Function
Response.Write bbcode_format("det [b]virker[/b] skam")
%>