|
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 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.