Regular expression for name in different languages

For the first time here) Hello, I need a regular expression that allows all types of letters, including Russian ones, allows spaces, numbers and dots. I need this for the full name field, on a multilingual site, because there may be Russian users and from all over the world. Thank you.

Answer 1, authority 100%

/^[a-z-0-9 _.]+$/gi

(Tested in perl.)

Answer 2, authority 100%

/^[\p{L}\p{M}\d\. ]+$/u

where \p{L}are all letters;

\p{M}– diacritics;

\d– numbers;

\.– dot;

– space.

^and $are needed to check the entire string.

The umodifier indicates that we are working in Unicode.

Perhaps the regular expression should be more strict so that the first character is only a letter

/^\p{L}[\p{L}\p{M}\d\. ]*$/u

Answer 3

Think carefully whether you can work with Russian letters later.
The regular is here:


But I don’t think you need it. If the task were described in more detail, since this regular expression will miss almost anything.
PS.. in the regular season everything is written in the order that you specified.

Answer 4

Regular: [\w\. ]+
But for processing, you need to use the functions of the mbstring module, otherwise only English letters will be recognized.