Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-09-21 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls