in reply to Re: Money Regex
in thread Money Regex

Uh, as long as you have no problem with it matching "" and "$" and "." that regex will do just fine. If you make everything in a regex optional, you aren't going to get what you really meant very often.

I'd start with /^\$?(\d+(\.\d{1,2})?|\.\d{1,2})$/ which requires there to be at least one digit before an optional decimal and 1 or 2 digits or that there be a decimal followed by 1 or 2 digits. It is ugly but it works.

--
$you = new YOU;
honk() if $you->love(perl)