cant get regex to work as i want

Posted by Jorm on Stack Overflow See other posts from Stack Overflow or by Jorm
Published on 2010-04-11T08:18:02Z Indexed on 2010/04/11 8:23 UTC
Read the original article Hit count: 314

Filed under:
|

With this function:

function bbcode_parse($str) {
$str = htmlentities($str);

$find = array(  
    '/\\*\*(.[^*]*)\*\*/is',
);

$replace = array(
    '<b>' 
);

$str = preg_replace($find, $replace, $str);  

return $str;
}

And with text "My name is **bob**"

I get in source code Hi my name is <b>

Been trying to get this to work for a while now.

Would appricate some expert help :)

© Stack Overflow or respective owner

Related posts about php

Related posts about regex