Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Regex help

by ikegami (Patriarch)
on Oct 25, 2004 at 22:07 UTC ( [id://402359]=note: print w/replies, xml ) Need Help??


in reply to Regex help

/B@{[join('|', 38..49)]}/
or
/B(?:38|39|40|41|42|43|44|45|46|47|48|49)/
or
/B(\d\d)/ && $1 >= 38 && $1 <= 49

Replies are listed 'Best First'.
Re^2: Regex help
by ikegami (Patriarch) on Oct 25, 2004 at 22:37 UTC
    or
    /B(?:3[89]|4\d)/
    or
    /B(?!3[0-7])[34]\d/
    or
    /B(\d\d)(?(?{ $1 < 38 || $1 > 49 })(?=A)(?=Z))/
      /B(?:3[89]|4\d)/
      This worked like a charm, and really helped me understand the proper syntax of the conditional test.

      Thanks much!

      CT

      Charles Thomas
      Madison, WI
        (?(?{code}true-regexp) (?(?{code}true-regexp|false-regexp) / B (\d\d) (? (?{ $1 < 38 || $1 > 49 }) # if invalid (?=A)(?=Z) # then fail # else succeed ) /x

        It could also have been written:

        / B (\d\d) (?(?{ $1 >= 38 && $1 <= 49 }) # if valid # succeed | # else (?=A)(?=Z) # fail ) /x

        (?=A)(?=Z) means the next char must be an 'A' and must be a 'Z'. That's never gonna happen.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found