#!/usr/bin/perl -w use strict; my @data = qw/ this123isnot -$100 100_00 100$00 10000 +$100 $+100 this is not /; foreach (@data) { if (/^(?:(?:[-+]?\$?)|(?:\$?[-+]))(?:\d{1,3}(?:,\d{3})*|\d+)(?:\.\d{1,2})?$/) { print "$_ : numeric!\n"; } else { print "$_ : non-numeric!\n"; } }