I'm using html_entity_decode to decode html codes, and then using preg_replace, but for some reason it's replacing all my single quotes for some reason. What am I doing wrong?
<?php
$userResponse = "I'm tired.";
$userResponse = html_entity_decode($userResponse); //make codes like ' into '
$userResponse = preg_replace("~[^*a-zA-Z,.!?' ]~", "", $userResponse);
echo $userResponse;
?>
Result: Im tired.
Expected Result: I'm tired.