×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Loyd,

You seem to already understand what's going on... so I'm taking your message just as an expression of astonishment, and a complaint that it doesn't work like .NET.

All I can say is that (a) I didn't design it, and (b) the ILE C functions work exactly the same as the RE functions provided in C languages on Unix systems, which have been around for 30+ years.

If you indeed are struggling to understand something, then please spell out what you don't understand. Because your code seems to work exactly as I would expect.


On 2/3/2010 2:18 PM, Loyd Goodbar wrote:
Hi Scott,

I'm trying to understand this too.
I changed the findWithin to 'There is none but the one or none at all.'. If
I were looking for regex matches for 'one', I would expect to find three:
[n]one in positions 11-13, one in 23-25, and [n]one in 31-33.

With findThis = '(one).*(one)'

I get the results:

MATCH.RM_SO(1) = 10
MATCH.RM_SS(1) = 0
MATCH.RM_EO(1) = 33
MATCH.RM_ES(1) = 0
MATCH.RM_SO(2) = 10
MATCH.RM_SS(2) = 0
MATCH.RM_EO(2) = 13
MATCH.RM_ES(2) = 0
MATCH.RM_SO(3) = 30
MATCH.RM_SS(3) = 0
MATCH.RM_EO(3) = 33
MATCH.RM_ES(3) = 0
MATCH.RM_SO(4) = -1
MATCH.RM_SS(4) = 0
MATCH.RM_EO(4) = -1
MATCH.RM_ES(4) = 0
MATCH.RM_SO(5) = -1
MATCH.RM_SS(5) = 0
MATCH.RM_EO(5) = -1
MATCH.RM_ES(5) = 0
With your explanation, the first element shows the entire match range (10-33
as offset, or 11-34 as position), which makes sense. The second element
shows the match for 10-13 (the first [n]one). The third element shows the
last match at 30-33 (the last [n]one). However the middle match, one at
positions 23-25, is not shown.

Is it an issue with the regex expression, such as "one" versus
"(one).*(one)", the regexec, or both? Perhaps I spent too much time with
.NET; the .NET syntax "Regex.matches(findWithin, findThis).count" would
yield 3, expected for my example.

Thanks,
Loyd


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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