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, |
In reply to Re: Multiline regexp question
by Athanasius
in thread Multiline regexp question
by andreas1234567
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |