Answer the question
In order to leave comments, you need to log in
How to cut contact information from a string?
Hey! There is a marketplace, and a supplier-client correspondence module. You need to parse all messages and cut them out: emails, phones, urls.
I wrote a basic function that does the job. But when clients start to bypass it and write something like:
mybox dog mail.ru
Plus seven 912 seven hundred fourteen seventy one ninety nine
SMS 7.9.1.2.1.2.3.4.5.6.7
Answer the question
In order to leave comments, you need to log in
Well, start supplementing your parser with the words "dog" with numerals, strange combinations of all sorts of types 3 digits through a dot, over time you will have a system that distinguishes almost everything.
On fl.ru a few years ago there was an unsuccessful idea - to read all messages of users.
And so, for me, the chance to make such a parser is a utopian idea. in extreme cases, you can send a picture, or instead of punctuation marks at the end of a sentence, give a number. You have no chance to prevent the transfer of contact data. Deal with it. And make your service more interesting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question