php remove the word starts with # -
this question has answer here:
i want remove words starts # in content.
for example
$content = "#test lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry #test2 standard dummy text ever since 1500s, when unknown printer took galley of type #test3 , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. #test4 popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum #test5."
here #test1, #test2, #test3, #test4, #test5 # words. want remove words.
i use preg_replace
. not getting output.
please me. thanks
you can try /#[a-z0-9]+/i
. pattern replace alphanumeric word followed #
blank.
preg_replace('/#[a-z0-9]+/i', '', $content)
Comments
Post a Comment