1

Topic: Phone numbers in a uniform format

I ask the help respected .
There is a database of a board of free declarations (the Server: MySQL (Localhost via UNIX socket) server Type: MariaDB the server Version: 5.5.52-MariaDB - MariaDB Server). In the course of declaration layout, users fill a field with phone number to whom as takes in head. Accordingly also number always on a miscellaneous is displayed. Whether there is a possibility to lead all phone numbers to one uniform standard type +X---- - for ten-character cellular telephones and +X-XXXXX-X-XX-XX - for five-digit stationary? Well, or at least only for cellular which begin with +7 or 8.
The table: bff_bbs_items. A column: phones. Business becomes complicated also that phone numbers get there in such here, for example, a type: a:1: {i:0; a:2: {s:1: "v"; s:16: "+ 7-988-322-35-64"; s:1: "m"; s:12: "7-x xxx xxxx";}}. That is phone number storage in a database has certain structure, there is stored both phone in an open type and its mask, displayed to the user before pushing the button "to show contacts".
I know, what at this forum there is a similar subject (http://www.sql.ru/forum/1072319/privede … ??????????), but in sql I not in tooth a foot, therefore also ask the help of experts.
The moderator: the Subject is transferred from a forum "Microsoft SQL Server".

2

Re: Phone numbers in a uniform format

aistmarket wrote:

I Ask the help respected .
...Whether there is a possibility to lead all phone numbers to one uniform standard type +X---- - for ten-character cellular telephones and +X-XXXXX-X-XX-XX - for five-digit stationary?.

The decision always is, if the task NP-full. Your task NP? Full?
While you will reflect over it, I to you recommend the task to allocate in an appropriate forum

aistmarket wrote:

... A database... The Server: MySQL...

Our decisions of your task do not help you in force

aistmarket wrote:

... In sql I not in tooth a foot...

3

Re: Phone numbers in a uniform format

It is necessary to delete all superfluous garbage, for this purpose it is possible to use REGEXP

4

Re: Phone numbers in a uniform format

yarnik, it not garbage. All this  should remain. That's just the point.

5

Re: Phone numbers in a uniform format

Ruslan Damirovich, to the person with anybody RastaYak (http://www.sql.ru/forum/1072319/privede … ??????????) helped. Suddenly there will be at a forum a kind soul. Plus 1000 to a karma for the help.

6

Re: Phone numbers in a uniform format

In MySQL too there is it
https://dev.mysql.com/doc/refman/5.7/en/replace.html

7

Re: Phone numbers in a uniform format

yarnik wrote:

for this purpose it is possible to use REGEXP

In MySQL it only checks on correspondence to a template.

aistmarket wrote:

it not garbage. All this  should remain

You define, to you to lead to the uniform form, deleting garbage, or to leave...

8

Re: Phone numbers in a uniform format

Akina, it was a question of a uniform format for phone numbers. Here here (a:1: {i:0; a:2: {s:1: "v"; s:11: " 89891950600 "; s:1: "m"; s:12: "89x xxx xxxx";}}) the red selects phone. All numbers get to a database in a various type (89891950600, +79891950600, 8 (989) 1950600, +7 (989) 195-06-00 and so on and so forth). Here they also need to be resulted to a uniform type, for example such +----. Besides, among this "garbage" as you name, there is the mask of phone shown to the user before pushing the button "to show contacts". Here it (a:1: {i:0; a:2: {s:1: "v"; s:11: "89891950600"; s:1: "m"; s:12: " 89x xxx xxxx ";}}), it is selected by the green. It corresponds to first two number signs of phone.

9

Re: Phone numbers in a uniform format

8-o