in reply to Regex problem with .+ matching newlines without /s

Just for fun...
$_ = <<END; recordID: blah fieldname: value foo : bar : baz END for (split /\n\s*/) { ($left, $right) = split /\s*:\s*/; #do stuff... printf "%10s:\t\'%s\'\n", $left, $right; }


-- All code is 100% tested and functional unless otherwise noted.

Replies are listed 'Best First'.
Re^2: Regex problem with .+ matching newlines without /s
by Aristotle (Chancellor) on Aug 31, 2004 at 21:40 UTC

    Don't forget to add a limit to split in case there are more colons than one in some line.

    Makeshifts last the longest.