in reply to Regex Question

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.

You're on the right track, though I suspect that the +? might not be doing what you want it do. It would help to show us a few representative records.

Would something like

while ( /^((?:DES|TN).*?(?:DATE|ZONE)[ A-Z0-9]*)$^$/sm ) { # $1 is the matched record, without the blank line }
work?

Replies are listed 'Best First'.
Re: Re: Regex Question
by set_uk (Pilgrim) on Jun 03, 2003 at 09:33 UTC
    Data looks as follows:-
    DES MAIL TN 001 0 02 00 TYPE SL1 CDEN DD CUST 0 KLS 1 FDN TGAR 0 LDN NO NCOS 0 09 DATE 9 MAR 2000 TN 001 0 02 01 05 RLS 06 TRN 07 AO3 08 09 ZONE 002 TN 001 0 02 01 05 RLS ZONE 001 07 AO3 08 09 DATE 9 MAR 2000