Hi,
I am new with using regular expressions, I am trying to test a string that can contain all utf-8 alphabetic characters (therefore eèéĕE… etc), white spaces (but no consecutive white spaces), no numbers, only single quotes (but no consecutive single quotes).
In my code I have tried this:
reading to Unicode character properties in PHP manual, I have inserted \pL
in the pattern and also a optional whitespace and a singlequote but the result is invalid!
And also I am trying to put instead delimiters for start and end of the string using ^
and $
but obtain an error and the script doesn’t run.
Can you help me, many thanks!
$text = "tèst";
if (preg_match("/\pL\s?'/", $text) == 1) {
echo "valid!";
} else {
echo "not valid!";
}