I need to match two word names like (Johny Cash). So I was using the regex:
L"^[A-Z][a-z]+\\s+[A-Z][a-z]+$"
However, I realized that the names may contain diacritics as well, something like Johannes Fürnkranz. I came across this solution: https://stackoverflow.com/a/8923865/1469954, and modified my regex to:
L"^[A-Z].\\p{L}+\\s+[A-Z].\\p{L}+$
This, assuming that the first letter in each word won't be a diacritic. However, I am getting an invalid regex error. Any idea how to make it work?
Aucun commentaire:
Enregistrer un commentaire