16-Dec-2013 12:06, seany пишет:
On Monday, 16 December 2013 at 07:56:53 UTC, evilrat wrote:


have you tried look the docs first?

phobos regex patterns described here
http://dlang.org/phobos/std_regex.html

The only mention of backtrack is : bmatch
it returns a regex object with a machine state, and last match, but it
is still not telling me how to actually do a backtrack match.

Docs don't state anything like that. It finds _first_ match and returns full state so that you may continue matching or just look at the current match.

Backtracking is purely irrelevant technical detail.

I.e. if i
know the machine state and a match (in my example, does that mean that
foo is returned as a match or does it mean thatbaz /bar is returned as a
match, and the next attempt will match the bar/baz - if not, then what
is the call sequence? bmatch (match bar/baz) then match FOO, then again
try to match what bmatch returned?)

Simply put match/bmatch will return a range of matches as they are found in the input. Each match is, in turn, a random access range that contains full match, followed by each sub-match in the pattern.

--
Dmitry Olshansky

Reply via email to