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!
#! perl use strict; use warnings; while (<DATA>) { chomp; print "$_ is a match\n" if /-\d+\d+\d+\d+\d+\d+\d+\d+\d+\d+\d+.*\. +.*/; } __DATA__ -523566.00 -0.0013 0.0045 -32742987982758110638106318307132432131.0000
Output:
21:30 >perl 543_SoPW.pl -32742987982758110638106318307132432131.0000 is a match 21:39 >
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):
/-\d{11,}.*\..*/
as per the answers above by moritz and BillKSmith.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Regex to check for very large negative numbers
by Athanasius
in thread Regex to check for very large negative numbers
by cspctec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |