[xpressive] Overlapping match results?

Is there a way to get overlapping match results from Xpressive? For example, when searching for "aa" in the string "aaaa", I want three results [as]as, a[aa]a, and aa[aa]. Currently, I'm only getting the two non-overlapping results [aa]aa and aa[aa]. I tried the regex 'a' >> before('a'). That almost gave me what I wanted (three results with the correct positions). The problem is that the lengths are wrong. What I need are lengths that include the before() characters. Is that possible? I know in this simple example I could just add 1 to the lengths, but I'm looking for overlapping results on more complex regexes. Thanks, Dave Jenkins

Dave Jenkins wrote:
Is there a way to get overlapping match results from Xpressive? For example, when searching for "aa" in the string "aaaa", I want three results [as]as, a[aa]a, and aa[aa]. Currently, I'm only getting the two non-overlapping results [aa]aa and aa[aa]. <snip>
The regex iterators only give non-overlapping results. If you want to find overlapping results, you can use the regex_search() algorithm iteratively, specifying the start position as what[0].first+1 instead of what[0].second. HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com

"Eric Niebler"
The regex iterators only give non-overlapping results. If you want to find overlapping results, you can use the regex_search() algorithm iteratively, specifying the start position as what[0].first+1 instead of what[0].second.
Thanks, Eric. That's what I needed.
participants (2)
-
Dave Jenkins
-
Eric Niebler