moonunit has asked for the wisdom of the Perl Monks concerning the following question:
This is supposed to take temperature measurements as a range, and leave only the lower part of it i.e. 25.3-26.5 -> 25.3. The first -? is for negative temperatures, as is the \- in the middle as in: -23--10.2. Decimal points are optional, as is the precision of the decimal.
It works for most of my numbers, but goes nuts with something like 52-52.5 -> 525. It should just leave 52, but tacks the trailing 5 on. Can anyone help explain this, or suggest an alternative superior regexp?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Misunderstood regexp
by japhy (Canon) on Jul 27, 2004 at 17:34 UTC | |
by moonunit (Initiate) on Jul 28, 2004 at 10:39 UTC | |
|
Re: Misunderstood regexp
by dragonchild (Archbishop) on Jul 27, 2004 at 17:37 UTC | |
|
Re: Misunderstood regexp
by Dietz (Curate) on Jul 28, 2004 at 06:48 UTC |