in reply to Re: Regular Expression Currency Check
in thread Regular Expression Currency Check

Hi I changed your code to:
/^\s*\$?(\d{1,3},(\d{3},)*\d{3}|\d+)(\.\d{2})?\s*$

To enforce the two decimal digits, but it's not picking up on it, it should like that right?

Replies are listed 'Best First'.
Re^3: Regular Expression Currency Check
by Anonymous Monk on Jun 02, 2005 at 13:43 UTC
    I think I got it, I just would like to add the last check, if value is more them 99999.99 to the reg. exp. as well, and here is the code so far:

    if ( ($payment=~/^\s*\$?(\d{1,3},(\d{3},)*\d{3}|\d+)(\.\d +{2})\s*$/) || ($payment > 99999.99) ) { print "^*$1-$2-$3-match*$payment*match*^<br>"; }else{print "No match";}