|Perl Monk, Perl Meditation|
Re: Regex Dollar Amountsby andreychek (Parson)
|on Oct 19, 2001 at 07:22 UTC||Need Help??|
You certainly seem to be on the right track. One thing that immediatly sticks out is that you don't appear to be using strict. That might really help with small things as they show up, as would turning on warnings (-w).
Another problem is that you put a question mark immediatly before the . in your regex. By doing that, the decimal point becomes optional, which doesn't appear to be what you want.
Also, I'm not quite sure what "$lengthdecimal" is.. you're using it in your "if" statement, I'm not sure if it's a misspelling, or if it was simply defined earlier in your code.
With these things in mind, I might try something like this: