>>>>> "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>
This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:35:22 EDT