Hey. I have an experimental function which converts bb tags. It works fine, but to a certain extent....
function adv_bbcode(){
$str = "1: [ url=http://localhost ] Local [ /url ]";
print preg_replace("/\[url=(\w+)\](\w+)\[\/url\]/", "<a href=$1>$2</a>", $str);
}
Now the problem, as you might expect, it won't match characters like ": / . ? * " etc. Im aware that if you want to match any char you use the ".". But im not quite sure how to use this. Help appreciated. Thanks.
Edit: OK VB stripped my slashes. But Im sure you can figured out where they go. The main problem lies in the (\w+) groups.