Preg_replace does not support metacharacters & quot; \ B & quot ;??? I want to match a word, such as hi. I want to mark the start and end with \ B. However, this function cannot be executed. Later, I checked it on the Internet and said "/" was used as the separator, but all the matches were matched. Cannot match a separate hi. this preg_replace does not support metacharacters "\ B "???
I want to match a word, such as hi. I want to mark the start and end with \ B. However, this function cannot be executed. Later, I checked it on the Internet and said "/" was used as the separator, but all the matches were matched. Cannot match the word "hi? Please enlighten me
------ Solution --------------------
/\ Bhi \ B/. you can try it.
------ Solution --------------------
PHP code
$ A = 'fhia hi fefefhi hiasdf hi'; $ B = '/\ bhi \ B/'; $ c = 'JJ '; echo preg_replace ($ B, $ c, $ );