|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Peter Brawley (peter.brawley
earthlink.net)
Date: Tue Sep 25 2007 - 11:04:20 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> does anyone have a nicer solution for this?
How about comparing ereg_replace( "[[:punct:]]","", $colvalue ) with
ereg_replace( "[[:punct:]]","", $comparisonvalue )?
PB
mysql wrote:
> hi listers
> we have a mysql based application, wherein phone numbers may be stored
> and searched for. it is not the primary goal of this application to
> handle phone numbers.
>
> phone numbers usually are entered in a form like 099 999 99 99 or
> 099-999-99-99, or substings thereof. actually, the application stores
> the phone numbers as they are entered in a text field.
>
> a user searching an entry by phone number, on a first sight, cannot
> know, how the number is stored. i therefore leave him the freedom to
> enter the (sub) search like "99 99" or "99-99". as i am in php, no
> problem to extract the space or the dash using regular expressions.
>
> regular expressions in mysql, however, do not return collected
> subresults, they only return, whether there was a match or not. so, in
> order to compare the above (sub) search with the stored phone number,
> i constructed the following ugly query:
>
> select columns from table where REPLACE(REPLACE(phone, '-', ''), ' ',
> '') REGEXP sub_search;
>
> does anyone have a nicer solution for this?
>
> thanks in advance
>
> suomi
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]