Skip to content

Commit

Permalink
Merge pull request #13426 from omus/patch-4
Browse files Browse the repository at this point in the history
RFC: Format for named groupings
  • Loading branch information
StefanKarpinski committed Oct 2, 2015
2 parents 3b81151 + 49aec7d commit 01a852d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/manual/strings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ use destructuring syntax to bind them to local variables::
Captures can also be accessed by indexing the :obj:`RegexMatch` object
with the number or name of the capture group::

julia> m=match(r"(?P<hour>\d+):(?P<minute>\d+)","12:45")
julia> m=match(r"(?<hour>\d+):(?<minute>\d+)","12:45")
RegexMatch("12:45", hour="12", minute="45")
julia> m[:minute]
"45"
Expand All @@ -756,7 +756,7 @@ subsitution string with ``s``. Capture group 0 refers to the entire match object
Named capture groups can be referenced in the substitution with ``g<groupname>``.
For example::

julia> replace("first second", r"(\w+) (?P<agroup>\w+)", s"\g<agroup> \1")
julia> replace("first second", r"(\w+) (?<agroup>\w+)", s"\g<agroup> \1")
julia> "second first"

Numbered capture groups can also be referenced as ``\g<n>`` for disambiguation,
Expand Down

0 comments on commit 01a852d

Please sign in to comment.