in reply to Re: Match multiple numberin thread Match multiple number
This matches 1.05.
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) { ...; } [download]
*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/ [download]
But, I think I like the [0-9]*[05] based solutions better...
Thanks,
www.com | www.net | www.org
I've not tried one yet I'm not impressed They are very useful They are indispensable
Results (95 votes). Check out past polls.