Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Multiline regexp question

by Athanasius (Archbishop)
on Dec 17, 2013 at 02:32 UTC ( [id://1067408]=note: print w/replies, xml ) Need Help??


in reply to Multiline regexp question

A variation: If the data file is large, you may want to avoid slurping it all into memory. In which case, set the input record separator $/ to a suitable string:

#! perl use strict; use warnings; use feature 'say'; { local $/ = 'TLE - Tag Logical Element'; while (<DATA>) { say "$1 $2" if /FQName\s+'(.*?)'.*\|-\s+'(.*?)'/s; } } __DATA__ <as before>

(Regex based on hdb’s ++answer.) Output:

12:17 >perl 802_SoPW.pl ENVELOPEID 5172986 CUSTOMER_NAME Acme Inc KUNDNAVN BANANA AIRLINES ZIP_CODE SE-971 74 COUNTRY SE FAKTURA 5643452 KONTRAKT 90234342 REGISTER AF89729 DATO 16.12.13 12:17 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found