@@ -414,21 +414,21 @@ Each of these anchors matches a boundary:
414414
415415Lookahead anchors:
416416
417- - <tt>(?=_pat_ )</tt>: Positive lookahead assertion:
417+ - <tt>(?=pat )</tt>: Positive lookahead assertion:
418418 ensures that the following characters match _pat_,
419419 but doesn't include those characters in the matched substring.
420420
421- - <tt>(?!_pat_ )</tt>: Negative lookahead assertion:
421+ - <tt>(?!pat )</tt>: Negative lookahead assertion:
422422 ensures that the following characters <i>do not</i> match _pat_,
423423 but doesn't include those characters in the matched substring.
424424
425425Lookbehind anchors:
426426
427- - <tt>(?<=_pat_ )</tt>: Positive lookbehind assertion:
427+ - <tt>(?<=pat )</tt>: Positive lookbehind assertion:
428428 ensures that the preceding characters match _pat_, but
429429 doesn't include those characters in the matched substring.
430430
431- - <tt>(?<!_pat_ )</tt>: Negative lookbehind assertion:
431+ - <tt>(?<!pat )</tt>: Negative lookbehind assertion:
432432 ensures that the preceding characters do not match
433433 _pat_, but doesn't include those characters in the matched substring.
434434
@@ -574,7 +574,7 @@ A simple regexp has (at most) one match:
574574 re.match('1943-02-04').size # => 1
575575 re.match('foo') # => nil
576576
577- Adding one or more pairs of parentheses, <tt>(_subexpression_ )</tt>,
577+ Adding one or more pairs of parentheses, <tt>(subexpression )</tt>,
578578defines _groups_, which may result in multiple matched substrings,
579579called _captures_:
580580
@@ -647,8 +647,8 @@ A regexp may contain any number of groups:
647647
648648- For a large number of groups:
649649
650- - The ordinary <tt>\\_n_ </tt> notation applies only for _n_ in range (1..9).
651- - The <tt>MatchData[_n_ ]</tt> notation applies for any non-negative _n_.
650+ - The ordinary <tt>\\n </tt> notation applies only for _n_ in range (1..9).
651+ - The <tt>MatchData[n ]</tt> notation applies for any non-negative _n_.
652652
653653- <tt>\0</tt> is a special backreference, referring to the entire matched string;
654654 it may not be used within the regexp itself,
@@ -661,7 +661,7 @@ A regexp may contain any number of groups:
661661
662662As seen above, a capture can be referred to by its number.
663663A capture can also have a name,
664- prefixed as <tt>?<_name_ ></tt> or <tt>?'_name_ '</tt>,
664+ prefixed as <tt>?<name ></tt> or <tt>?'name '</tt>,
665665and the name (symbolized) may be used as an index in <tt>MatchData[]</tt>:
666666
667667 md = /\$(?<dollars>\d+)\.(?'cents'\d+)/.match("$3.67")
@@ -676,7 +676,7 @@ When a regexp contains a named capture, there are no unnamed captures:
676676 /\$(?<dollars>\d+)\.(\d+)/.match("$3.67")
677677 # => #<MatchData "$3.67" dollars:"3">
678678
679- A named group may be backreferenced as <tt>\k<_name_ ></tt>:
679+ A named group may be backreferenced as <tt>\k<name ></tt>:
680680
681681 /(?<vowel>[aeiou]).\k<vowel>.\k<vowel>/.match('ototomy')
682682 # => #<MatchData "ototo" vowel:"o">
@@ -732,10 +732,10 @@ see {Atomic Group}[https://www.regular-expressions.info/atomic.html].
732732
733733==== Subexpression Calls
734734
735- As seen above, a backreference number (<tt>\\_n_ </tt>) or name (<tt>\k<_name_ ></tt>)
735+ As seen above, a backreference number (<tt>\\n </tt>) or name (<tt>\k<name ></tt>)
736736gives access to a captured _substring_;
737737the corresponding regexp _subexpression_ may also be accessed,
738- via the number (<tt>\\g<i>n</i></ tt>) or name (<tt>\g<_name_ ></tt>):
738+ via the number n (<tt>\\gn</ tt>) or name (<tt>\g<name ></tt>):
739739
740740 /\A(?<paren>\(\g<paren>*\))*\z/.match('(())')
741741 # ^1
@@ -768,12 +768,12 @@ See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings
768768
769769==== Conditionals
770770
771- The conditional construct takes the form <tt>(?(_cond_)_yes_|_no_ )</tt>, where:
771+ The conditional construct takes the form <tt>(?(cond)yes|no )</tt>, where:
772772
773773- _cond_ may be a capture number or name.
774774- The match to be applied is _yes_ if _cond_ is captured;
775775 otherwise the match to be applied is _no_.
776- - If not needed, <tt>|_no_ </tt> may be omitted.
776+ - If not needed, <tt>|no </tt> may be omitted.
777777
778778Examples:
779779
@@ -802,7 +802,7 @@ The absence operator is a special group that matches anything which does _not_ m
802802
803803==== Unicode Properties
804804
805- The <tt>/\p{_property_name_ }/</tt> construct (with lowercase +p+)
805+ The <tt>/\p{property_name }/</tt> construct (with lowercase +p+)
806806matches characters using a Unicode property name,
807807much like a character class;
808808property +Alpha+ specifies alphabetic characters:
@@ -1033,23 +1033,23 @@ See also {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
10331033
10341034Each of these modifiers sets a mode for the regexp:
10351035
1036- - +i+: <tt>/_pattern_ /i</tt> sets
1036+ - +i+: <tt>/pattern /i</tt> sets
10371037 {Case-Insensitive Mode}[rdoc-ref:Regexp@Case-Insensitive+Mode].
1038- - +m+: <tt>/_pattern_ /m</tt> sets
1038+ - +m+: <tt>/pattern /m</tt> sets
10391039 {Multiline Mode}[rdoc-ref:Regexp@Multiline+Mode].
1040- - +x+: <tt>/_pattern_ /x</tt> sets
1040+ - +x+: <tt>/pattern /x</tt> sets
10411041 {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
1042- - +o+: <tt>/_pattern_ /o</tt> sets
1042+ - +o+: <tt>/pattern /o</tt> sets
10431043 {Interpolation Mode}[rdoc-ref:Regexp@Interpolation+Mode].
10441044
10451045Any, all, or none of these may be applied.
10461046
10471047Modifiers +i+, +m+, and +x+ may be applied to subexpressions:
10481048
1049- - <tt>(?_modifier_ )</tt> turns the mode "on" for ensuing subexpressions
1050- - <tt>(?-_modifier_ )</tt> turns the mode "off" for ensuing subexpressions
1051- - <tt>(?_modifier_:_subexp_ )</tt> turns the mode "on" for _subexp_ within the group
1052- - <tt>(?-_modifier_:_subexp_ )</tt> turns the mode "off" for _subexp_ within the group
1049+ - <tt>(?modifier )</tt> turns the mode "on" for ensuing subexpressions
1050+ - <tt>(?-modifier )</tt> turns the mode "off" for ensuing subexpressions
1051+ - <tt>(?modifier:subexp )</tt> turns the mode "on" for _subexp_ within the group
1052+ - <tt>(?-modifier:subexp )</tt> turns the mode "off" for _subexp_ within the group
10531053
10541054Example:
10551055
@@ -1166,22 +1166,22 @@ A regular expression containing non-US-ASCII characters
11661166is assumed to use the source encoding.
11671167This can be overridden with one of the following modifiers.
11681168
1169- - <tt>/_pat_ /n</tt>: US-ASCII if only containing US-ASCII characters,
1169+ - <tt>/pat /n</tt>: US-ASCII if only containing US-ASCII characters,
11701170 otherwise ASCII-8BIT:
11711171
11721172 /foo/n.encoding # => #<Encoding:US-ASCII>
11731173 /foo\xff/n.encoding # => #<Encoding:ASCII-8BIT>
11741174 /foo\x7f/n.encoding # => #<Encoding:US-ASCII>
11751175
1176- - <tt>/_pat_ /u</tt>: UTF-8
1176+ - <tt>/pat /u</tt>: UTF-8
11771177
11781178 /foo/u.encoding # => #<Encoding:UTF-8>
11791179
1180- - <tt>/_pat_ /e</tt>: EUC-JP
1180+ - <tt>/pat /e</tt>: EUC-JP
11811181
11821182 /foo/e.encoding # => #<Encoding:EUC-JP>
11831183
1184- - <tt>/_pat_ /s</tt>: Windows-31J
1184+ - <tt>/pat /s</tt>: Windows-31J
11851185
11861186 /foo/s.encoding # => #<Encoding:Windows-31J>
11871187
0 commit comments