× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have not seen this arrive from the list. I beg your pardon if it
appears twice.

-------- Forwarded Message --------
From: Terrence Enger <tenger@xxxxxxxxxxxxxxxx>
Reply-To: tenger@xxxxxxxxxxxxxxxx
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: regular expressions, I am puzzled
Date: Thu, 30 Jul 2009 14:35:37 -0400

Greetings,

There has been a bit of discussion about regular expressions on
c400-l, but I am bringing my question here because I do not know
that my question has anything to do with the programming
language. On the other hand, the regular expression APIs are
documented in SC41-5607-03 "ILE C/C++ Runtime Library Functions",
and I transcribed some stuff from QSYSINC/H(REGEX); so ya takes
yur chances. For what it's worth, I am using V5R2, ILE RPG, and
extended regular expressions.

My regular expression exerciser is giving results which
contradict both my preconceptions and the web-based exercisers
which I have tried. First, a test giving the results I expect.
Reported from and to numbers are rm_so and rm_eo within the array
of regmatch_t returned from regexec().


Previous result 0 1 2 3 4
0....+....0....+....0....+....0....+....0....+....
Input string . . . : nuttin
Regular expression : (n)(u)(t*)(i)
Matches . . . . . .: Sub# Details Starting
---- --------------------- --------
0 from 0 to 5, length 5 nutti
1 from 0 to 1, length 1 n
2 from 1 to 2, length 1 u
3 from 2 to 4, length 2 tt
4 from 4 to 5, length 1 i

But when I add an extra set of parentheses, the offsets of
subexpressions in that added subexpression sometimes are somewhat
reduced.


Previous result 0 1 2 3 4
0....+....0....+....0....+....0....+....0....+....
Input string . . . : nuttin
Regular expression : (n)(u)((t*)(i))
Matches . . . . . .: Sub# Details Starting
---- --------------------- --------
0 from 0 to 5, length 5 nutti
1 from 0 to 1, length 1 n
2 from 1 to 2, length 1 u
3 from 2 to 5, length 3 tti
4 from 1 to 3, length 2 ut
5 from 3 to 4, length 1 t

Within the section on extended regular expressions in "The Single
UNIX (R) Specification, Version 2, Regular Expressions"
<http://www.opengroup.org/onlinepubs/007908799/xbd/re.html>, I
have looked at each cause of undefined behaviour, and I don't see
that any of them applies to what I am doing.

Do these results make any sense? Or, are there any ideas about
what I could be doing wrong? Should anybody care, perchance, I
can provide the source for my exerciser program.

Thank you, for your attention.

Cheers,
Terry.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.