regex - How to replace QUOTES like forums with php? -


i know should using preg_replace i'm not best regex. me code replacing [quote=user]quote here[/quote] to:

<p><b>user</b>quote here</p> 

thanks lot in advance.

try this:

$str = '[quote=user]quote here[/quote]';  $regex = '/\[quote=(.+)\](.+?)\[\/quote\]/'; $replacement = '<p><b>$1</b>$2</p>'; $str = preg_replace($regex, $replacement, $str); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -