Hi Terry

My first thought would be to use 2 regexes - the first to extract the substring you want to perform the second on.

So in your case, something like


But I donât get what you are trying to accomplish so I have no idea if this is applicable.

After reading the manual extract posted doing it this way may at leads give me mortals a chance of understanding what you are trying to do.

Evan Harris

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Terrence Enger
Sent: Tuesday, 4 August 2009 7:21 a.m.
To: Midrange Systems Technical Discussion
Subject: Re: [Fwd: regular expressions, I am puzzled]

On Mon, 2009-08-03 at 12:22 -0500, Scott Klement wrote:
Hi Terry,

Have you read the following (from regexec topic in the "ILE C Runtime
Library" manual):

If subexpression i is contained within another subexpression j, and i
is not contained within any other subexpression that is contained
within j, and a match of subexpression j is reported in pmatch[j],
then the match or non-match of subexpression i reported in pmatch[i]
will be as described in 1. and 2. above, but within the substring
reported in pmatch[j] rather than the whole string.

No, I should have been following that. Thank you.

In a simple case, I see that behaviour: regex "nu((t*)(i))" and string
"nuttin" return
rm_so rm_eo
----- -----
2 5
0 2
2 3

Introduction of a set of parentheses earlier in the regex should not, as
I read it, change the result returned for the last two subexpressions.
But the result for regex "n(u)((t*)(i))" is
ï rm_so rm_eo
----- -----
1 2
2 5
1 3
3 4

Thank you for your help, Scott. Any further thoughts?


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].