in reply to Regex Dollar Amounts
And just for fun -- another option you have is to do this test with JavaScript. More recent JavaScript versions support regexes. If you want to support older browsers, there are other ways to go about testing input. If you catch the error before if hits your server, it saves a tremendous amount of time, which makes your application faster, which makes your users happier :-)# Test to see if we got the expected input if($amount =~ m/^-?(\d+)\.(\d\d)$/) { my $integerpart = $1; my $decimalpart = $2; # Display template for correct input here } else { # Display template for error here }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex Dollar Amounts
by Additude (Initiate) on Oct 19, 2001 at 15:13 UTC | |
by Additude (Initiate) on Oct 19, 2001 at 15:51 UTC |