in reply to Likely trivial regex question
Is that a URL-encoded form?
use URI qw( ); my %fields = URI->new('?'.$str)->query_form(); say "fields present" if exists($fields{ beer }) && exists($fields{ vodka }) && exists($fields{ chips }); say "matches" if ($fields{ beer } // "") =~ /^(?:[0-9]{2})\z/ && ($fields{ vodka } // "") =~ /^(?:[0-9]{2})\z/ && ($fields{ chips } // "") =~ /^(?:[0-9]{3})\z/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Likely trivial regex question
by moodywoody (Novice) on Nov 09, 2011 at 07:04 UTC | |
by ikegami (Patriarch) on Nov 09, 2011 at 07:48 UTC | |
by moodywoody (Novice) on Nov 09, 2011 at 08:02 UTC |