Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: matching numeric range

by esskar (Deacon)
on Feb 24, 2005 at 22:21 UTC ( #434283=note: print w/replies, xml ) Need Help??


in reply to matching numeric range

i give it a try
use strict; my @check = ('A4:123:C'); my @ranges = ('A0-7:123:C', 'B8-15:456:D', 'A5-7:123:C'); foreach my $check (@check) { my @cp = $check =~ m!(\w)(\d+):(\d+):(\w)!; foreach my $range (@ranges) { if($range =~ m!$cp[0](\d+)\-(\d+):$cp[2]:$cp[3]!) { if($check[0] >= $1 and $check[0] <= $2) { print "$check mathes $range\n"; } } } }
HTH

Replies are listed 'Best First'.
Re^2: matching numeric range
by state-o-dis-array (Hermit) on Feb 24, 2005 at 22:42 UTC
    This is probably closer to what I am looking for, thanks esskar, I have to play with the my @cp = $check =~ m!(\w)(\d+):(\d+):(\w)!; line, I've never done something like that.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://434283]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2023-02-05 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (32 votes). Check out past polls.

    Notices?