shortyfw06 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to modify the following regular expression, which is for integers either negative or positive.
$_[0] =~ /^(?:|-|\d+|-\d+)$/
I'd like the regular expression to also capture floating point values either negative or positive. I thought this would work but it is not.
$_[0] =~ /^(?:|-|\d+|-\d+|\d+\.\d+|-\d+\.\d+)$/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Floating Point/Integer Regular Expression
by tobyink (Canon) on Jul 25, 2012 at 15:29 UTC | |
by shortyfw06 (Beadle) on Jul 25, 2012 at 15:46 UTC | |
by tobyink (Canon) on Jul 25, 2012 at 23:45 UTC | |
|
Re: Floating Point/Integer Regular Expression
by moritz (Cardinal) on Jul 25, 2012 at 16:49 UTC |