http://qs1969.pair.com?node_id=1220596


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

This matches 1.05.

Replies are listed 'Best First'.
Re^3: Match multiple number
by dbuckhal (Chaplain) on Aug 19, 2018 at 05:38 UTC
    yeah, but it satisfies the OP's implied set of integer values given by x=x+5 | {0, 5, 10, 15, 20, 25, ...}

      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,