Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Unable to constrain the effect of a negative lookahead

by Marshall (Canon)
on Apr 17, 2022 at 03:27 UTC ( [id://11143016]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2026-02-11 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.