in reply to Re^2: Search replace with a block
in thread Search replace with a block
Also perlfaq6 has some tips$rawconfig =~ s{ <location \s+ (\S+?)> (.+?) </location> }{ ReformulateLocation("$1", "$2"); }gimsex; print $rawconfig; sub ReformulateLocation { my( $loc, $con ) = @_; my @pairs = $con =~ m{ ^ \s* (\S+) \s+ ([^\r\n]+?) \s* $}gmix; dd( { $loc, \@pairs } ); return "<location $loc> $con </location>"; ## no change } __END__ { "/" => ["MaxConnPerIP", 12, "NoIPLimit", "image/*"] } { "/location2" => ["MaxConnPerIP", 0] } { "/location3" => ["MaxConnPerIP", 0] } <IfModule> ## workaround of some kind <IfModule mod_limitipconn.c> <location /> MaxConnPerIP 12 NoIPLimit image/* </location> <location /location2> MaxConnPerIP 0 </location> <location /location3> MaxConnPerIP 0 </location> </IfModule>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Search replace with a block
by santoshrao99 (Initiate) on May 12, 2016 at 05:46 UTC | |
by beech (Parson) on May 12, 2016 at 06:31 UTC | |
by santoshrao99 (Initiate) on May 12, 2016 at 08:04 UTC |