I try to build a Tagging System and it works fine there is an issue with function preg_replace(), it removes unnecessary spaces from the string.
An example of that is if my string is that
Hey !
@Yosi
@Ben
Spaces will be removed and it will become to that:
Hey!
@Yosi@Ben
It seems because my condition in preg_replace included as a string.
My code:
$String = preg_replace ('/(\s|^)@'.$Memory['Name'][$x].'(\s|$)/', '[URL="http://'.$_SERVER['HTTP_HOST'].'/member.php?u='.$Memory['UserID'][$x].'"]@'.$Memory['Name'][$x].'[/URL]', $String);