Skip to content

Conversation

natecook1000
Copy link
Member

firstMatch(of:) was ignoring the start/endIndex when searching in substrings; this change fixes that issue. Also adds the 'in' label to Regex.firstMatch(in:Substring) to match the rest of the related APIs.

`firstMatch(of:)` was ignoring the start/endIndex when searching in
substrings; this change fixes that issue. Also adds the 'in' label
to `Regex.firstMatch(in:Substring)` to match the rest of the related
APIs.
@natecook1000 natecook1000 requested a review from itingliu April 15, 2022 21:16
@natecook1000
Copy link
Member Author

@swift-ci Please test

///
/// Returns `nil` if no match is found and throws on abort
public func firstMatch(_ s: Substring) throws -> Regex<Output>.Match? {
public func firstMatch(in s: Substring) throws -> Regex<Output>.Match? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought Output was renamed to RegexOutput?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex's generic parameter is still named Output.

@natecook1000 natecook1000 merged commit a342405 into swiftlang:main Apr 18, 2022
@natecook1000 natecook1000 deleted the substring_match branch April 18, 2022 15:46
Azoy pushed a commit to Azoy/swift-experimental-string-processing that referenced this pull request Apr 19, 2022
`firstMatch(of:)` was ignoring the start/endIndex when searching in
substrings; this change fixes that issue. Also adds the 'in' label
to `Regex.firstMatch(in:Substring)` to match the rest of the related
APIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants