A
A
Alexander2015-05-16 10:00:22
PHP
Alexander, 2015-05-16 10:00:22

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

...then my parser is powerless. Can anyone come across a good ready-made solution? Of those that I have seen, the parser on AirBnB is perfectly made, it is very difficult to deceive it.
PS Of course, I understand that 100% recognition of contacts can never be done, but I need to weed out the largest possible number of such "tricks".

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
myfirepukan, 2015-05-16
@myfirepukan

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.

D
Dmitry Bay, 2015-05-16
@kawabanga

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 question

Ask a Question

731 491 924 answers to any question