set_uk has asked for the wisdom of the Perl Monks concerning the following question:
I have a file full of records split across multiple lines. The records start with wordA or wordB and end with either wordC or wordD followed by a blank line.
Can someone tell me how to start searching for either of 2 words and stop searching when I discover either of the other 2 words followed by a blank line.
I should be able to use the range operator - but its not playing.
Trying local $/ = undef; $StartTN = qr/(^DES|^TN).*?/; $EndTN = qr/((DATE[ A-Z0-9]*)+?(?=^$)|ZONE [ A-Z0-9]*(?=^$))/; if ( /($StartTN)/smx .. /($EndTN)/smx) { }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Question
by tos (Deacon) on Jun 03, 2003 at 11:26 UTC | |
by set_uk (Pilgrim) on Jun 03, 2003 at 12:14 UTC | |
by tos (Deacon) on Jun 03, 2003 at 12:42 UTC | |
|
Re: Regex Question
by BrowserUk (Patriarch) on Jun 03, 2003 at 09:24 UTC | |
by set_uk (Pilgrim) on Jun 03, 2003 at 10:45 UTC | |
by BrowserUk (Patriarch) on Jun 03, 2003 at 11:11 UTC | |
by set_uk (Pilgrim) on Jun 03, 2003 at 11:51 UTC | |
by BrowserUk (Patriarch) on Jun 03, 2003 at 12:53 UTC | |
|
Re: Regex Question
by dws (Chancellor) on Jun 03, 2003 at 09:04 UTC | |
by set_uk (Pilgrim) on Jun 03, 2003 at 09:33 UTC |