in reply to Re: What does this regex do?
in thread What does this regex do?

As a general rule, a good way to build complex regexes is to be long-winded. Don't optimize. List each case in full:
$interest !~ ( ^ # start of line -? # optionally negative (?: \d+ # numbers with no decimal point | \d+\.\d+ # numbers with decimal point in middle | \.\d+ # numbers with decimal point at start | \d+\. # numbers with decimal point at end ) $ # end of line /x;
From this starting point, you can then attempt to optimize some the cases, if you want. But there's no need to: perl will optimize them for you. --Dave