Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Reg Expression Question

by blakem (Monsignor)
on Aug 31, 2001 at 12:06 UTC ( [id://109320]=note: print w/replies, xml ) Need Help??


in reply to Re: Reg Expression Question
in thread Reg Expression Question

$i =~ /[0|5|8|15|20]/

But that will also match 30,15,888,150,200, etc...

If you really want to use a regex for this, you'll need to anchor it like so:

$i =~ /^(0|5|8|15|20)$/;
Though I still think a hash is a better solution.

Update: changed the square brackets to parens, thanks Hofmator...

-Blake

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found