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

Re: Range Issue with RegEx

by liverpole (Monsignor)
on Jul 10, 2006 at 14:19 UTC ( [id://560147]=note: print w/replies, xml ) Need Help??


in reply to Range Issue with RegEx

There are a few problems in your code:

First of all, [30-33] does NOT match 30, 31, 32; it matches any of the single characters 3, 0 - 3, 3, which is the same as [0-3].  (The expression [...] is a character class, meaning that it matches only a single character).

Secondly, when you do /50[0-2]|5[30-33]/, you are trying to match 4 characters in a row:  5, 0, 0-2 or 5, 0-3.

I think what you want instead is:

if ($tag =~ /^(50[0-2])|(53[0-2])$/)

or more simply:

if ($tag =~ /^(50|53)[0-2]$/)

or even:

if ($tag =~ /^5(0|3)[0-2]$/) # Note the parentheses ( ) are optiona +l

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found