I ran into an annoyance where Regex findAll did no...
# stdlib
d
I ran into an annoyance where Regex findAll did not match overlapping parts. I propose to add a findAllWithOverlap defined as follows:
Copy code
fun findAllWithOverlap(input: CharSequence, startIndex: Int = 0): Sequence<MatchResult> {
     if (startIndex < 0 || startIndex > input.length) {
         throw IndexOutOfBoundsException("Start index out of bounds: $startIndex, input length: ${input.length}")
    }  
return generateSequence({ find(input, startIndex) }, { find(input, it.range.first + 1) })
 }