Right... This was the kind of workaround for lack of "non greedy" I was 
thinking of. Wondering what the IBM C++ support for non-greedy (if any) 
is.

Martin

Martin Packer,
Mainframe Performance Consultant, zChampion
Worldwide Banking Center of Excellence, IBM

+44-7802-245-584

email: [email protected]

Twitter / Facebook IDs: MartinPacker
Blog: 
https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker



From:
Bill Godfrey <[email protected]>
To:
[email protected], 
Date:
06/02/2012 16:25
Subject:
Re: Regular Expressions (OMVS)
Sent by:
IBM Mainframe Discussion List <[email protected]>



On Mon, 6 Feb 2012 08:44:01 -0600, Ken MacKenzie 
<[email protected]> wrote:

>Hi All,
>
>I'm not sure if this is the appropriate forum, please point me to the 
correct one if it's not.
>
>I'm playing around with regular expressions and I want to achieve the 
following.  I spoke to a Unix geek but he didn't really understand what I 
was asking.
>
>Given the following sample data, I want discover only the first 
occurrence of any string which matches my regexp.
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ
>
>I tried: awk 'sub(/CD.*QR/,"junkt")' fxdata in an attempt to change 
QQQQABCDEFGNOPQRXXX to QQQQABjunktXXX but instead, it takes the final 
occurrence of QR, and returns QQQQABjunktZZZ. Notice the ZZZ on the end 
instead of XXX.
>
>This is being driven from a REXX exec in ISPF, if any of the above is not 
clear, I will try to explain further.
>

try this:

awk 'sub(/CD[^Q]*QR/,"junkt")'

or this:

sed -e 's/CD[^Q]*QR/junkt/'

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN








Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU






----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to