Ubb| program Remember to post a UBB code converted to HTML format code, a few days ago read UBB source code. So there's this new version. Note that this version may not be used properly, see note in detail.
This code translates the user-entered UBB code into HTML format, noting that it requires the support of script Engine 5.0 (enabling
With the RegExp object)
Note: used in pattern () will know the value of the RegExp memory search, which is the first (), the rest of the analogy. But the $
The syntax is not supported by the 5.0 version of Vbscript.dll, I checked the version on my machine (IE 5.5 was installed),
The Vbscript.dll version was found to be 5.50.4629, and the last modification date is December 25. This version supports the words
method, this simple improvement makes the function of RegExp gradually close to Perl's regular expression
function Ubbcode (strcontent)
Dim objregexp
Set objregexp=new REGEXP
Objregexp.ignorecase =true
Objregexp.global=true
' URL
Objregexp.pattern= "(\[url\]) (http:\/\/\s+?) (\[\/url\]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "$" "
Target=_blank>$2</a> ")
Objregexp.pattern= "(\[url\]) (\s+?) (\[\/url\]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "Http://$2" "
Target=_blank>$2</a> ")
' Email
Objregexp.pattern= "(\[email\]) (\s+\@\s+?) (\[\/email\]) "
Strcontent= Objregexp.replace (strcontent, "<a
href= "" Mailto:$2 "" >$2</A> ")
Objregexp.pattern= "(\[img\]) (\s+?) (\[\/img\]) "
Strcontent=objregexp.replace (strcontent, "
Objregexp.pattern= "(\[quote\]) (. +?) (\[\/quote\]) "
Strcontent=objregexp.replace (strcontent, "<blockquote><font size=1
Face= "" Verdana, Arial "" >quote:</font><HR>$2<HR></BLOCKQUOTE> "
Objregexp.pattern= "(\[i\]) (. +?) (\[\/i\]) "
Strcontent=objregexp.replace (strcontent, "<i>$2</i>")
Objregexp.pattern= "(\[b\]) (. +?) (\[\/b\]) "
Strcontent=objregexp.replace (strcontent, "<b>$2</b>")
Set objregexp=nothing
Ubbcode=strcontent
End Function
The original conversion process, excerpted from the freeware version of the UBB forum, can be
http://www.ultimatebb.com/Download (Perl CGI method)
Sub Ubbcode {
my $ThePost = shift;
$ThePost =~ s/(\[url\]) (http:\/\/\s+?) (\[\/url\])/<a href= "$"
Target=_blank>$2<\/a>/ISG;
$ThePost =~ s/(\[url\]) (\s+?) (\[\/url\])/<a href= "http:\/\/$2"
Target=_blank>$2<\/a>/ISG;
$ThePost =~ s/(\[email\]) (\s+\@\s+?) (\[\/email\])/<a
href= "mailto:$2" >$2<\/A>/isg;
if (($UBBImages eq "on") && ($OverrideImages ne "yes")) {
$ThePost =~ s/(\[img\]) (\s+?) (\[\/img\])//isg;
}
$ThePost =~ s/(\[quote\]) (. +?) (\[\/quote\])/<blockquote><font size= "1"
Face= "Verdana, Arial" >quote:<\/font><HR>$2<HR><\/BLOCKQUOTE>/isg;
$ThePost =~ s/(\[i\]) (. +?) (\[\/i\])/<i>$2<\/i>/isg;
$ThePost =~ s/(\[b\]) (. +?) (\[\/b\])/<b>$2<\/b>/isg;
return ($ThePost);
}
Learn about the comrade of ASP, do not give up the study of CGI, especially some foreigner's CGI program, look after to our ASP programming
It's going to be a big inspiration.