[plt-scheme] regexp multiple matches?
Unless I'm missing something, regexp-match and pregexp-match don't seem
geared towards collecting all occurrences of a pattern in a string. I want
to be able to do something like this:
(call-with-input-file myfile
(lambda (in)
(regexp-match pat in)))
...except that I want the result to contain all (non-overlapping) matches of
the pattern, not just the first match. An alternative which invokes a thunk
for every match would also be fine. Does anything like this already exist?
Of course, I can implement this using regexp-match-positions. But this
seems like something that ought to be implemented within the regexp
packages, with a for-each or fold-style procedure.
(so that, when developing my program, I can avoid implementing irritatingly
imperative iterations in its input. :)
Anton