JetBrains/kotlin — pull request #117 by cy6erGn0m (2012-08-02 16:51:32+00:00)
Title: Simple Regexp API extensions

This commit provides simple API to work with java regular expression. It extends java.util.regex.Matcher functionality to iterate through matches, to collect them to list. Also simple way for replacement added.

forEachMatchResult - iterates over all remaining matches and construct MatchResult for each match occurence.

allMatchResults - just collects all remaining matches into list.

forEachMatch and allMatches does the same but it supply String instead of MatchResult. It less flexible but easier to use.

replace - simple function for text replacement. Example from testcase:
```kotlin
assertEquals("before 1 2 3 4 5 after",
"before 1 22 333 4444 55555 after".createMatcher(p).replace {
it.group()!!.charAt(0).toString()
})
```