Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
Hi Darryl After all that I must confess that when I'm making config changes to multiple servers, I use Rex: http://rexify.org/ https://metacpan.org/pod/Rex which is something like Puppet-lite:) Andrew On Thu, Jul 14, 2016 at 11:04 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
I settled for an set of stacked if statements, saving the previous line if needed etc... Thanks for the help. Darryl Baker PMOET -DAPS X76674

Re: A multi line pattern match question

2016-07-14 Thread Charles DeRykus
One easier approach: use Tie::File; tie( my @array, 'Tie::File', "/path/to/file" ) or die $!; my $n = 0; while ( $n <= $#array ) { if ( $array[$n] =~ /.*[Oo]rder deny,allow(.*)/ and $n < $#array and $array[$n+1] =~ /[\Dd]eny from all(.*)/ ) { $n

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 2:56 PM, Rob McAninch wrote: > > > On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > >> On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < >> darryl.ba...@northwestern.edu> wrote: >> >> While not truly a beginner it feels

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker wrote: While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert t

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many years. > > I currently need a program to take Apache HTTPD configuration files in > HTTPD 2.2 syntax u

A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert them to HTTPD 2.4 syntax in future production. I will need to

Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
I'm guessing the problem is the newline in the regex. If you want it to match across multiple lines, I think the /ms modifiers should do the trick. if ( m/{.*}[Oo]rder deny,allow(.*)\n(.*)[Dd]eny from all(.*)/ms) { NOTE: I haven't tried this myself!:) failing that, $ perldoc perlre may be o

Re: Pattern match question

2009-05-27 Thread Jenda Krynicky
Date sent: Wed, 27 May 2009 16:50:41 +0800 Subject:Pattern match question From: Á÷Ë(R)`Oô To: beginners@perl.org > Hi, All: > > I want to parse data from a HTML page,

Re: Pattern match question

2009-05-27 Thread Alexander Koenig
You wrote on 05/27/2009 10:50 AM: > I want to match one ... pair. > > my code : > > my $pattern = "()"; ... > but I got the whole matches instead of one ... pair each loop. Do need to de-greedify it. my $pattern = "()"; This should do the trick. hth Alex -- To unsubscribe, e-mail: beginner

Pattern match question

2009-05-27 Thread 流水音
Hi, All: I want to parse data from a HTML page, data like: YEMEN YE

Re: pattern match question

2004-05-05 Thread Jose Alves de Castro
/(?<=Retrieval command for )http:.*?:/){ > > It prints off the "Retrieval command for" part as it did before :( > > > any ideas? > > > Cheers, > > Graeme :) > > > > >From: Jose Alves de Castro <[EMAIL PROTECTED]> > >To: Gr

Re: pattern match question

2004-05-05 Thread Graeme McLaren
ROTECTED]> To: Graeme McLaren <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: pattern match question Date: 05 May 2004 11:09:19 +0100 MIME-Version: 1.0 Received: from onion.perl.org ([63.251.223.166]) by mc5-f36.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Wed, 5 May 2004 03:13:0

Re: pattern match question

2004-05-05 Thread Jose Alves de Castro
I would do /(?<=Retrieval command for )http:.*?:/ The "Retrieval" part now is contained in a "Look behind section", which is to mean it's not going to be stored as part of the match. I'm not sure what other cases you can get in that log file, but this solves the problem for that particular line

pattern match question

2004-05-05 Thread Graeme McLaren
Hi, I'm trying to build a regular expression. to match a URL from a logfile. In the logfile an example of the pattern I'm trying to match is: 12:12:1:http://10.2.203.1/missing1.html: Retrieval command for http://10.2.203.1/missing1.html: GET /missing1.html HTTP/1.0 so far I've got: =~ /^.*?Ret