| KW.pm | Regular Expressions | #21 |
$threenum = '\d{3}';
$areacode = '\(' . $threenum . '\)';
$fournum = '\d{4}';
$phonenum = "$areacode$threenum-$fournum";
if( $input =~ /^$phonenum$/o ) {
...
}
$phonenum = qr/$areacode$threenum-$fournum/;
if( $input =~ /^$phonenum$/ ) {
...
}| << Previous | Index | Next >> | Copyright © 2002 Christopher Calzonetti |