Skip to content
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

document use (and risk) of $N special capture group variables (#3979) #4023

Merged
merged 1 commit into from Feb 15, 2017
Merged

document use (and risk) of $N special capture group variables (#3979) #4023

merged 1 commit into from Feb 15, 2017

Conversation

karlseguin
Copy link
Contributor

@karlseguin karlseguin commented Feb 12, 2017

addresses issue #3979

@Sija
Copy link
Contributor

Sija commented Feb 12, 2017

I'd add a note about nilable $N? variables too.

src/regex.cr Outdated
# ```
# /(spice)(s)?/.match("spice") # => #<Regex::MatchData "spice" 1:"spice" 2:nil>
# $1 # => "spice"
# $2 # => Exception
Copy link
Contributor

Choose a reason for hiding this comment

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

The best comment for exception will be # raises Exception, following the other inline examples (see #3820)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also document the exception type raised.

src/regex.cr Outdated
# ```
#
# This can be mitigated by using the nilable version of the above: $N?,
# (e.g., $1? $2?, $3?, ...). Changing the above to use `$2?` isntead of `$2`
Copy link
Member

Choose a reason for hiding this comment

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

Typo: isntead

@spalladino
Copy link
Contributor

LGTM. As soon as the typo is fixed, let us know and we'll merge. Thanks!

@matiasgarciaisaia matiasgarciaisaia merged commit 809baa9 into crystal-lang:master Feb 15, 2017
@matiasgarciaisaia
Copy link
Member

Thanks, @karlseguin!

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.

None yet

6 participants