Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Matching data against non-consecutive range

by bart (Canon)
on Jan 27, 2005 at 22:07 UTC ( [id://425787]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Regex::PreSuf;
    my $re = presuf(10..374, 376..379, 382..385, 388..499, 530..534, 541..
    +543, 618, 619, 700..704, 707..709);
    print "Regex: /$re/\n";
    
  2. or download this
    Regex: /(?:1(?:0[0123456789]|1[0123456789]|2[0123456789]|3[0123456789]
    +|4[0123456789]|5[0123456789]|6[0123456789]|7[0123456789]|8[0123456789
    +]|9[0123456789]|[0123456789])|2(?:0[0123456789]|1[0123456789]|2[01234
    +56789]|3[0123456789]|4[0123456789]|5[0123456789]|6[0123456789]|7[0123
    +456789]|8[0123456789]|9[0123456789]|[0123456789])|3(?:0[0123456789]|1
    +[0123456789]|2[0123456789]|3[0123456789]|4[0123456789]|5[0123456789]|
    +6[0123456789]|7[012346789]|8[234589]|9[0123456789]|[0123456789])|4(?:
    +0[0123456789]|1[0123456789]|2[0123456789]|3[0123456789]|4[0123456789]
    +|5[0123456789]|6[0123456789]|7[0123456789]|8[0123456789]|9[0123456789
    +]|[0123456789])|5(?:3[01234]|4[123]|[0123456789])|6(?:1[89]|[01234567
    +89])|7(?:0[01234789]|[0123456789])|8[0123456789]|9[0123456789])/
    
  3. or download this
    $zip = '34';
    if($zip =~ /\b$re\b/o) {
        print "Got a match for $zip\n";
    }
    
  4. or download this
    Got a match for 34
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-20 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found