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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -