Skip to content

Conversation

@regier21
Copy link
Contributor

Fixes #40347. I went ahead and added documentation for the the RegexMatch type as well. I also updated the manual to destructure on m rather than m.captures.

Sorry about the second PR. I had whitespace issues in the old PR (#40485) and accidentally made a mess of the the commit graph trying to fix it, so I squashed those commits and opened a new PR.

* Added documentation for RegexMatch and keys(::RegexMatch)

* Updated the manual

* Fix trailing whitespace
@regier21 regier21 changed the title Regexmatch doc (#1) Add Documentation to RegexMatch and keys(::RegexMatch) Apr 14, 2021
base/regex.jl Outdated
Comment on lines 175 to 176
julia> hr, min, ampm = m
RegexMatch("11:30", hour="11", minute="30", 3=nothing)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
julia> hr, min, ampm = m
RegexMatch("11:30", hour="11", minute="30", 3=nothing)
julia> hr, min, ampm = m;

base/regex.jl Outdated
"""
keys(m::RegexMatch) -> Vector
Returns a vector of keys for all capture groups of the underlying regex.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Returns a vector of keys for all capture groups of the underlying regex.
Return a vector of keys for all capture groups of the underlying regex.

base/regex.jl Outdated
Returns a vector of keys for all capture groups of the underlying regex.
A key is included even if the capture group fails to match.
That is, `idx` will be in the return value even if `m.captures[idx] == nothing`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
That is, `idx` will be in the return value even if `m.captures[idx] == nothing`.
That is, `idx` will be in the return value even if `m[idx] == nothing`.

@kshyatt kshyatt added the docs This change adds or pertains to documentation label Apr 15, 2021
@regier21
Copy link
Contributor Author

@fredrikekre thanks for the review! Just pushed new commit accepting all suggestions.

@regier21
Copy link
Contributor Author

A test failed but I'm pretty sure it's unrelated to the PR.

@vtjnash vtjnash merged commit 83f5786 into JuliaLang:master Apr 19, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document retrieving capture group names from Regex or RegexMatch

4 participants