Re: [GENERAL] regular expressions in query

2005-02-15 Thread Lincoln Yeoh
But that method would be specific for searches for the last 4 digits. It won't work as well for the general case of the last X digits. To clarify the method I suggested: Say a phone number is: 818 9567 1234 You reverse the number and store it as text and index it as 43217659818 Then if someone se

Re: [GENERAL] regular expressions in query

2005-02-13 Thread J. Greenlees
Lincoln Yeoh wrote: At 09:57 AM 2/13/2005 +, Russ Brown wrote: I've thought about things like this in the past, and a thought that occurred to me was to add a functional index on just_digits(telephone) to the table. Would this not allow the above query to use an index while searching? I t

Re: [GENERAL] regular expressions in query

2005-02-13 Thread Lincoln Yeoh
At 09:57 AM 2/13/2005 +, Russ Brown wrote: I've thought about things like this in the past, and a thought that occurred to me was to add a functional index on just_digits(telephone) to the table. Would this not allow the above query to use an index while searching? I think it should. But fo

Re: [GENERAL] regular expressions in query

2005-02-13 Thread Russ Brown
elein wrote: No doubt someone more adept at perl can write this function as a one-liner. create or replace function just_digits(text) returns text as $$ my $innum = $_[0]; $innum =~ s/\D//g; return $innum; $$ language 'plperl' SELECT telephone FROM addresses WHE

Re: [GENERAL] regular expressions in query

2005-02-12 Thread elein
No doubt someone more adept at perl can write this function as a one-liner. create or replace function just_digits(text) returns text as $$ my $innum = $_[0]; $innum =~ s/\D//g; return $innum; $$ language 'plperl' SELECT telephone FROM addresses WHERE user_id

Re: [GENERAL] regular expressions in query

2005-02-12 Thread Tom Lane
"F.Bissett" <[EMAIL PROTECTED]> writes: > On Fri= > , 11 Feb 2005 19:56:33 -0800, Jeff Davis wrote: font-size:10pt;color:navy;">>=A0Try using the "~" regex matching operato= > r instead of ILIKE. N style=3D"font-size:10pt;color:navy;">> 10pt;">>=A0Regar= > ds, size:10pt;color:navy;">>=A0Jeff Davis

Re: [GENERAL] regular expressions in query

2005-02-12 Thread Scott Marlowe
On Sat, 2005-02-12 at 10:31, F.Bissett wrote: > On Fri, 11 Feb 2005 19:56:33 -0800, Jeff Davis wrote: > >Try using the "~" regex matching operator instead of ILIKE. > > > >Regards, > >Jeff Davis > > > > > > I still need the ILIKE to compare the returned value with $telephone. > > > > I have

Re: [GENERAL] regular expressions in query

2005-02-12 Thread F.Bissett
On Fri, 11 Feb 2005 19:56:33 -0800, Jeff Davis wrote:> Try using the "~" regex matching operator instead of ILIKE.>> Regards,> Jeff Davis>   I still need the ILIKE to compare the returned value with $telephone.   I have the following PHP to check an input string for non numeric characters:   $tel =

Re: [GENERAL] regular expressions in query

2005-02-11 Thread Jeff Davis
Try using the "~" regex matching operator instead of ILIKE. Regards, Jeff Davis On Fri, 2005-02-11 at 22:21 +, fiona wrote: > My database table holds phone numbers that may contain characters other > than digits (that's not a problem in itself). > > I want to be able to apply a regu

[GENERAL] regular expressions in query

2005-02-11 Thread fiona
My database table holds phone numbers that may contain characters other than digits (that's not a problem in itself). I want to be able to apply a regular expression (to ignore all characters except digits) to the attribute 'phone' first and then for the ILIKE to compare the result to $telephon