Does somebody know how to convert a big of PHP "eregi_replace" to VB code please?
hi there people..
I have this simple PHP code to allow people to use bold / italic / underlined etc text in guestbook's etc, via bbcode...
PHP Code:
<?php
$code = "This is a string with lots of bb code stuff in";
echo "$code\n\n\n\n\n\n\n";
echo bbcode($code);
function bbcode($string) {
// Image BB Code
$string=eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","<img src=\"\\1\" border=0>",$string);
// URL Hyperlink BB Code
$string=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">\\1</a>",$string);
$string=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$string);
$string=eregi_replace("\\[url=www.([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>",$string);
$string=eregi_replace("\\[url=http://([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://\\1\" target=\"_blank\">\\2</a>",$string);
// EMail Hyperlink BB Code
$string=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$string);
$string=eregi_replace("\\[email=([^\\[]+)\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\2</a>",$string);
// Font size and color BB Code
$string=eregi_replace("\\[size=([^\\[]+)\\]([^\\[]*)\\[/size\\]","<font size=\"\\1\">\\2</font>",$string);
$string=eregi_replace("\\[color=([^\\[]+)\\]([^\\[]*)\\[/color\\]","<font color=\"\\1\">\\2</font>",$string);
// Text Formatting BB Code
$string=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$string);
$string=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$string);
$string=eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","<u>\\1</u>",$string);
return $string;
}
?>
Now, i want to be able to use BB Code in a visual basic application, and am at a loss where to start with converting it really...
i guess somebody has probally done something simular (and chances are, alot better) for their own applications, but, can somebody help me convert this code please?
Thanks.