N
N
nezzard2017-10-24 21:52:50
PostgreSQL
nezzard, 2017-10-24 21:52:50

How to cut string for fio?

Good afternoon, please tell me the regular expression so that the line of the form
Surname First Name Patronymic becomes the type Surname I.O.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2017-10-24
@Taraflex

No way. Surnames/first names can contain spaces, hyphens and apostrophes - it is impossible to determine unequivocally where the surname ended and the name began
https://habrahabr.ru/post/259121/

echo preg_replace('/(\s[А-ЯЁ])[а-яё]+/u','$1.','Фамилия Имя Отчество');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question