Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: matching numeric range

by esskar (Deacon)
on Feb 24, 2005 at 22:21 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-19 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found