#!/usr/bin/perl use strict; use warnings; use Regexp::Common; while (<DATA>) { chomp; my $zip_match = 0; if (/$RE{zip}{US}{-keep}/) { $zip_match ++; $zip_match ++ if $6; } printf "Value %d for zip code '%s'\n", $zip_match, $_; } __DATA__ 6789 12345 12345-6789 Value 0 for zip code '6789' Value 1 for zip code '12345' Value 2 for zip code '12345-6789'
Abigail
In reply to Re: Zipcode Regex Help
by Abigail-II
in thread Zipcode Regex Help
by tcf22
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |