I need some regex that removes words as specified in title. I have tried below regex but it didn't worked. Also i want to extract "#User#" from given string - means starting with '#' and ending with '#' from string which don't contains any space.
preg_match_all("~#(.*?)#~", “#User#,<br><br>Thanks#For providing” ,
$wordReplaceArr_tmp);
Result of above code is below:
Output: User#,<br><br>Thanks
Expected result: "#User#"