Perhaps I'm going about this all wrong, but I'm trying to get all the matches in a string for a particular regex pattern. I'm using re-matcher to get a Match object, which I pass to re-find, giving me (full-string-match, grouped-text) pairs. How would I get a sequence of all the matches produced by the Match object?

In Clojuresque Python, it would look like:

pairs = []
match = re-matcher(regex, line)

while True:
    pair = re-find(match)
    if not pair: break
    pairs.append(pair)

Any suggestions?

Edit
Report