I have this regex:
<?PHP
$test = 'this is a #test';
$regex = "#(\#.)#i";
$test = preg_replace($regex, '<strong>$1</strong>', $test);
echo $test;
?>
and I want the word after # to be in strong, but I only have #t in strong, does anybody have a suggestion?
thanks a lot
use
+to match any one or more number literals. Use*, if you want to include0occurrence of literals after#.Please refer PHP Regex Repetition documentation for details.