Home » Php » php Cannot replace em dash

php Cannot replace em dash

Posted by: admin October 26, 2018 Leave a comment

Questions:

I am scraping a html page and working with the contents. My page is UTF-8 as is the page I am scraping.
I have looked at this question, but it does not work for me.
PHP Replace EM Dash REGEX

The piece of data I am reading is this which is stored in $v

 25th March –Â The Red Barn

I need to remove the special characters between March and The.
Looking in a hex editor, the first character is an em dash : E2 80 93

I have tried this as suggested in the question above, but it does not remove character.

$v = mb_ereg_replace("[\xE2\x80\x93]", "", $v);

I cannot remove the other character either : C3 82
I suspect this is for the same reason.

Please help.

Answers: