in reply to Unable to constrain the effect of a negative lookahead

Here is another technique for you. Just use a split to get the part of the string before the "batch =", then an unconstrained regex match global upon that. Yes, this does have to process the string twice, but the code is clear, short and does not require fancy regex features.

use strict; use warnings; my $SYSPBUFF = <<__EOD__; run_type = dev, max_monitor_time = 0.25 verbosity_level = 2 batch = ( source = sample_document_collection_1 files = Confucius.docx dest = Enterprise:Department ) __EOD__ my ($top) = split(/\s*batch\s*=/,$SYSPBUFF,2); my %hash = $top =~ m/([\w\.]+)\s*=\s*([\w\.]+)/g; print "$_ => $hash{$_}\n" for (keys %hash); __END__ max_monitor_time => 0.25 verbosity_level => 2 run_type => dev