RegexBuilder Repeat range off by one

I'm not sure this is the intended output:

import RegexBuilder

let s = "aaaaaaaaaa"
let rx = Regex {
    Repeat(0...1) { "a" }
s.firstMatch(of: rx) // ["aa"]

(eager) Repeat with ranges grabs one symbol more than requested. Should I file a bug?

Version 14.0 beta (14A5228q)
swift -version
swift-driver version: 1.55.1 Apple Swift version 5.7 (swiftlang- clang-1400.0.16.2)

This indeed looks like a bug, I've filed Off by one error for `Repeat(...)` · Issue #478 · apple/swift-experimental-string-processing · GitHub

1 Like

This should be fixed in Xcode 14 beta 4