The user enters their input "@userinput" which will then change to '<a href="userinput"> userinput </a>'.
Any help would be greatly appreciated, my attempts can be seen below.
My attempts.
Code:
preg_match('#(?>\@)(\w*)#', $string, $matches);
foreach($matches as $row){
$string = preg_replace('#(?>\@)(\w*)#', '<a href="'.$row.'"> '. $row . "</a>", $string);
}
Code:
$string = preg_replace('#\@(.*)#', '<b><a href="=$1"=> @$1 </a></b>', $string);