如何检查该字符串是否包含任何语言的字母?

My current regex is /^[a-zA-Z]+( [a-zA-Z]+)*$/. It works for names like:

John Smith

Anyway, the site is international and name could be like this, for example:

Jānis Bērziņš

It's a valid name, but regex will fail to validate it because of ā, ē and š chars.

The one way would be to type all chars that are allowed, but then the list would be HUGE!

I'm looking for easier way to do that. Maybe black-list instead of white-list approach?

Thanks in any advice!

Use a regex in UTF-8 mode with the appropriate Unicode character propert(y/ies).

Just replace your character class with the unicode property for letter \pL

/^\pL+( \pL+)*$/

See here on regular/expressions.info an overview of the unicode properties

in my test on writecodeonline.com this is working

$s = "Jānis Bērziņš";
preg_match("/^\\pL+( \\pL+)*$/", $s, $matches);