The review of SE-0355: Regex Syntax and Runtime Construction has come to a close.
Feedback was light, as the majority of discussion focused primarily on the concurrent review of regex literals.
In reviewing the proposal, the Language Workgroup agrees with the proposers that compatibility with existing regex syntax is an important goal for this feature in Swift. This affects the two main areas of discussion:
- Capture group numbering starting at 1, rather than 0 (with 0 as the whole match). While this may be surprising for newcomers to regular expressions, adjusting this would be even more surprising to those experienced with them in other contexts (who make up the majority of users of this feature). Additionally, altering the base would make references to capture groups source incompatible with any regex syntax that used them.
- Swift allowing many syntax variants (e.g.
\s), rather than favoring a “one true syntax”. One suggestion was allowing all syntax for runtime construction, but requiring the favored syntax for literals. The workgroup felt the two should remain consistent.
SE-0355 has therefore been accepted without modifications.
Thank you for participating in this review and contributing to Swift.