Skip to content

Add Substring algorithms tests #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2022

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

@@ -123,7 +123,7 @@ extension Regex {
/// Find the first match in a substring
///
/// 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