-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deprecate matchall #26071
Deprecate matchall #26071
Conversation
stdlib/REPL/src/REPLCompletions.jl
Outdated
@@ -201,7 +201,7 @@ function complete_path(path::AbstractString, pos; use_envpath=false) | |||
end | |||
|
|||
matchList = String[replace(s, r"\s" => "\\ ") for s in matches] | |||
startpos = pos - lastindex(prefix) + 1 - length(matchall(r" ", prefix)) | |||
startpos = pos - lastindex(prefix) + 1 - count(c -> c == ' ', prefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this change is correct. AFAICT it is, but the original code is such a convoluted way of doing this that I feel like I may be missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right to me, too. Could be equalto(' ')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realized that right after pushing. Fixed while rebasing.
5665931
to
3395955
Compare
I'll merge once CI passes barring objections. |
test/regex.jl
Outdated
@test f(r"GCG","GCGCG") == ["GCG"] | ||
@test f(r"GCG","GCGCG",overlap=true) == ["GCG","GCG"] | ||
end | ||
@test collect_eachmatch(r"a?b?", "asbd") == ["a","","b","",""] == f(r"""a?b?""", "asbd") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've got an old f()
call in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed!
It is not obvious that returning matching SubStrings rather than RegexMatch objects is a good idea.
3395955
to
52b5205
Compare
Ruby has a Is it too late to add (or reserve) this name for julia-07?
I'd much more prefer:
-- Maurice |
There's no need to reserve names: exporting new names from Base is not considered breaking. |
Bonjour, This post is moved to discourse: So what is the best way from julia-1.3+ for getting a String Vector from a regex like with matchall?
-- Maurice |
Instead of commenting on old issues, it is better to open a new thread at https://discourse.julialang.org/ for questions. |
I'd like to lightly disagree with this statement. I found this issue by using the changelog. I was looking for why Of course, the true value is the cross-link to the discourse page, but since that doesn't happen automatically it's valuable to see discourse open here before ultimately moving to a better home. |
It is not obvious that returning matching
SubString
s rather thanRegexMatch
objects is a good idea.Fixes #26049.