I need a regex to match a letter of any alphabet, but not a number or punctuation. I have tried things like:
$match = "~\b(,\s?\b)*$~";
and
$match = "~\w+(,\s?\w+)*$~";
But both let in dashes etc
I even tried to write an exclusion like [^0-9 -+,.*&]
but it was a nightmare trying to escape the escaped etc. Any help gratefully received.
Note: This follows on from yesterday's quesiton on the comma seperated list: validate comma separated list using regex
This:
$value = '[A-Z]+';
$match = "~^$value(,\s?$value)*$~i";
if (!empty($associations) && !preg_match($match,$associations))
//return error, not comma seperated list of words
}
else {
// go ahead
}
But then the client asked that it match umlauts