Answer the question
In order to leave comments, you need to log in
How to choose a surname from the text?
How can I select a full name from the text? "Buy #300 Ivanov Ivan IVANOVICH address Tverskaya 6" if possible? And the text will be different Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Tomita-parser to help :)
this is not a regular expression, but what you need.
api.yandex.ru/tomita
And what to choose then? If it's just text, then something like
echo "Покупать #300 Иванов иван ИВАНОВИЧ адрес Тверская 6" | awk '{print $3}'
Иванов
You need to redo the forms where the user enters data. Don't let him fill in everything with one text, give several input fields - Surname, First Name, Patronymic, Address, Comment.
In no automatic way is it possible in 100% of cases to extract data from an arbitrarily written string. After all, you won’t even be sure that the user has entered all the data. And if you make separate input fields, then you can check them separately, store them separately. And users are already used to entering all the data separately - this is done almost everywhere on the sites, for the reasons indicated above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question