Re: Phone numbers

From: Charles Daminato (chuck@opensrs.org)
Date: Wed Mar 29 2000 - 09:52:05 EST


*please stop cross posting*

Also, we Canadians didn't write the code for this ;) *grin*

I agree that + should be a part of the allowed fields, or at least allowed
as the first character. Off to the 'non-Canadian' development team ;)

"James H. Cloos Jr." wrote:
>
> >>>>> "Mike" == Mike Bilow <mikebw@colossus.bilow.com> writes:
>
> Mike> I don't think this is quite what you want. Since '+' is a
> Mike> meta-character, it needs to be preceded by a backslash escape:
>
> Mike> if ($data->{owner_phone} !~ /^[\d\s\-\.\(\)\+]+$/) {
> Mike> $problem_fields{Phone} = $data->{owner_phone}; }
>
> If you put it in the [], it doesn't require the backslash.
>
> But it shouldn't be in the []. The + is only valid at the start of
> the phone number. The regexp should be /^\+?[\d\s\-\.\(\)]+$/
>
> Mike> By the way, as a matter of maintainable programming style, this
> Mike> long regex should be placed into a standard scalar that is
> Mike> initialized once and then reused as needed:
>
> Agreed. And it perhaps should be done via use constant.
>
> -JimC
> --
> James H. Cloos, Jr. <URL:http://jhcloos.com/public_key> 1024D/ED7DAEA6
> <cloos@jhcloos.com> E9E9 F828 61A4 6EA9 0F2B 63E7 997A 9F17 ED7D AEA6
> Save Trees: Get E-Gold! <URL:http://jhcloos.com/go?e-gold>

-- 

Charles Daminato OpenSRS Technical Operations chuck@opensrs.org



This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:35:22 EDT