Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Matching an integer between 0 and 100

by ikegami (Pope)
on Sep 01, 2009 at 16:42 UTC ( #792700=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $pat = qr/
        ([0-9]+)
        (?(?{ my $n = $^N; $n <= 0 || $n >= 100 })(?!))
    /x;
    
  2. or download this
    my $pat = qr/0|[1-9][0-9]?/;
    
  3. or download this
    my ($pat) =
        map qr/$_/,
        join '|',
        #map quotemeta,
        1..99;
    
  4. or download this
    use Regexp::List qw( );
    my $pat = Regexp::List->new()->list2re( 1..99 );
    
  5. or download this
    my $pat = qr/
        ([0-9]+)
        (?(?{ my $n = $^N; $n < 0 || $n > 100 })(?!))
    /x;
    
  6. or download this
    my $pat = qr/0|100|[1-9][0-9]?/;
    
  7. or download this
    my ($pat) =
        map qr/$_/,
        join '|',
        #map quotemeta,
        0..100;
    
  8. or download this
    use Regexp::List qw( );
    my $pat = Regexp::List->new()->list2re( 0..100 );
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-07-30 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls