P is for Practical | |
PerlMonks |
Re: Regex to check for very large negative numbersby Athanasius (Archbishop) |
on Feb 22, 2013 at 11:50 UTC ( [id://1020146]=note: print w/replies, xml ) | Need Help?? |
Hello cspctec, You claim that the regex m/-\d+\d+\d+\d+\d+\d+\d+\d+\d+\d+\d+.*\..*/ “always matches” — but it doesn’t!
Output:
Perhaps the problem lies in how you’re testing the regex against the data? Incidentally, you can write an equivalent regex more compactly using the {n,} quantifier, which will “Match at least n times” (see “Quantifiers” in Regular Expressions):
as per the answers above by moritz and BillKSmith. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|