Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Match multiple number

by dbuckhal (Chaplain)
on Aug 19, 2018 at 05:38 UTC ( [id://1220597]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Match multiple number
in thread Match multiple number

yeah, but it satisfies the OP's implied set of integer values given by x=x+5 | {0, 5, 10, 15, 20, 25, ...}

Replies are listed 'Best First'.
Re^4: Match multiple number
by tobyink (Canon) on Aug 19, 2018 at 06:33 UTC

    Yes, it matches all the valid inputs, but it also matches various invalid inputs.

    If all you care about is matching valid inputs and don't care about matching invalid ones, you can just do:

    if (1) { ...; }

      *click!* Got it... For my attempt, adding the \A assertion to match my \z should fix allowing invalid values.

      if $n =~ /\A\d{0,}[05]\z/

      But, I think I like the [0-9]*[05] based solutions better...

      Thanks,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-11-18 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.