UNIX REGULAR EXPRESSIONS QUESTIONS

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eric Richardson
Date:  
Subject: UNIX REGULAR EXPRESSIONS QUESTIONS
ROBERT HENDLEY wrote:
>
> QUESTION?
>
> I have a field in mysql that has phone numbers stored in it. The problem
> is that the program that originally stored the phone numbers into this
> field let any thing through i.e.. joe, 48-967--5678, 6-12345456ext50
> etc. To the new application I am required to use the existing data. I
> would like a querry that will remove all records that are not in the
> form 9999999999 and if possible update all valid phone numbers that just
> have "-" in them but the right amount of digits.
>

I'm not sure about mysql but I have used the SQL fcns ltrim, rpad,
concat, rtrim, substr, translate, length, to query and update and
generally clean up data. Depending on what the data looks like, you
could first remove all the dashes, put ext50 in a extensions column etc.
By visually inspecting you can wonders with manually updating and
modifying data. If there is no area code, then you have some bad data.

Hope this helps,
Eric :-)