I'm looking for a regex to find words in string starting with # and not have any more repeated #
Given:
Hi I'm #hany #هانى my Friend #john#john is ##here . good bye#all .
I want the final result as this:
Hi I'm <a>#hany</a> <a>#هانى</a> my Friend #john#john is ##here . good bye#all .
I'm using this:
echo preg_replace('/(?!\b)#(\\S+)/','<a>$0</a>',$string);
I want only words starting with #
and not have any more hashes like twitter hash-tags.