in reply to REGEX Frustration

What you describe is a CSV (character separated value) file and there are a plethora of modules available to handle that format for you. A good starting point is Text::CSV. Using such a module your problem turns into:

use strict; use warnings; use Text::CSV; my $dataStr = <<DATA; 1/1/1923\tFirst entry\t-23.45 2/2/1924\t"Second entry with a long multi-line description. This is parsed fine using Text::CSV, but I bet your regex chokes."\t23 +.23 DATA my $csv = Text::CSV->new({sep_char => "\t", binary => 1}); open my $dataIn, '<', \$dataStr; while (my $row = $csv->getline($dataIn)) { my ($date, $description, $value) = @$row; print "Value is $value\n"; } close $dataIn;

Prints:

Value is -23.45 Value is 23.23

As an aside the regex magic you want is the ? modifier:

use strict; use warnings; use Text::CSV; my $dataStr = <<DATA; 1/1/1923\tFirst entry\t-23.45 2/2/1924\t"Second entry with a long multi-line description. This is parsed fine using Text::CSV, but I bet your regex chokes."\t23 +.23 DATA open my $dataIn, '<', \$dataStr; while (my $line = <$dataIn>) { next if $line !~ /(-?\d*\.\d*)/; print "Value is $1\n"; } close $dataIn;

Prints:

Value is -23.45 Value is . Value is .

which you will note still fails in nasty ways because the regex isn't near sufficient to extract the data you want. However, there are a huge number of errors in the regex you show so you absolutely must go read some of the regex documentation: perlretut, perlre and perlreref for a start.

True laziness is hard work