Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Regular expression query

by BillKSmith (Monsignor)
on Nov 12, 2017 at 22:35 UTC ( [id://1203244]=note: print w/replies, xml ) Need Help??


in reply to Regular expression query

With the /m flag, a regex can match over more than one line.
C:\Users\Bill\forums\monks>type 1203224.pl use strict; use warnings; my $output = <<'END_OUT'; PEM 0: PEM 1: PEM 2: State: Online PEM 3: State: Online END_OUT while ($output =~ m/^(PEM\s\d) \: $ \n ^ \s\sState: [ ]+ (Online)$/xmg +) { print "$1 $2\n"; } C:\Users\Bill\forums\monks>perl 1203224.pl PEM 2 Online PEM 3 Online
Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found