On Dec 1, 2005, at 8:21, Joel Divekar wrote:

For eg. the decimal number will be as follows

Max Size : 99999.99
valid values : 3.00 or 745.15 or 21576.00
invalid values : 3.001 or 745.1555 or 215766.00
also 3..00 should be marked invalid.

Looks like the validity depends on the digits around the dot somehow.

***********************************
my $a = "3.89011";

if ($a=~/^\d{0,5}\.\d{0,2}/)

That would make "3.001" valid because it has two digits after the dot (it has a total of three, so it has two). To assert you want at most 2 put another anchor, assuming the string has no newline at the end

    ^\d{0,5}\.\d{0,2}$

may do. But that depends on my interpretation of the examples, if that regexp does not work please define what's a valid number.

-- fxn

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to