I'm validating an internationalized name such as L'étoile
with this regex:
/^[\pL',-.\s]+$/
When I capture the input and run it through the regex, there is no match:
<input type="text" name="firstname" value="">
$value = trim($_POST['firstname']);
$pattern = "/^[\pL',-.\s]+$/";
print $value.'<br />';
print preg_match_all($pattern, $value, $match);
This prints:
L'étoile
0
However when I hard code a string like below it matches just fine.
$value = "L'étoile";
$pattern = "/^[\pL',-.\s]+$/";
print $value.'<br />';
print preg_match_all($pattern, $value, $match);
This prints:
L'�toile
1