I think this covers all eventualities.use strict; use warnings; my $area = 800; my $pre = 555; my $not = 9999; $_ = join '', <DATA>; print "$area-$pre-$1\n" while m/$area(?:\)?\s|\.|-)$pre[\s\.-]((?!9999 +)\d{4})/g; __DATA__ 1-800-555-9999 1-800-555-3456 (800) 555-3456 800 555 3456 800 555-3456 800.555.3456 800 555.5555
In reply to Re: Phone Number Regular Expression
by TedPride
in thread Phone Number Regular Expression
by lev36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |