diff --git a/complex.c b/complex.c
index 7b6c6c2a99..85d724f273 100644
--- a/complex.c
+++ b/complex.c
@@ -1803,7 +1803,7 @@ rb_dbl_complex_new(double real, double imag)
* Complex.rect(1, Rational(0, 1)).to_i # => 1
*
* Raises RangeError if self.imag is not exactly zero
- * (either Integer(0) or Rational(0, _n_)).
+ * (either Integer(0) or Rational(0, n)).
*/
static VALUE
nucomp_to_i(VALUE self)
@@ -1827,7 +1827,7 @@ nucomp_to_i(VALUE self)
* Complex.rect(1, Rational(0, 1)).to_f # => 1.0
*
* Raises RangeError if self.imag is not exactly zero
- * (either Integer(0) or Rational(0, _n_)).
+ * (either Integer(0) or Rational(0, n)).
*/
static VALUE
nucomp_to_f(VALUE self)
@@ -1852,7 +1852,7 @@ nucomp_to_f(VALUE self)
* Complex.rect(1, 0.0).to_r # => (1/1)
*
* Raises RangeError if self.imag is not exactly zero
- * (either Integer(0) or Rational(0, _n_))
+ * (either Integer(0) or Rational(0, n))
* and self.imag.to_r is not exactly zero.
*
* Related: Complex#rationalize.
diff --git a/dir.rb b/dir.rb
index 0088bb39fa..eb1a408ee3 100644
--- a/dir.rb
+++ b/dir.rb
@@ -319,14 +319,14 @@ class Dir
#
# Dir.glob('io.?') # => ["io.c"]
#
- # - '[_set_]': Matches any one character in the string _set_;
+ # - '[set]': Matches any one character in the string _set_;
# behaves like a {Regexp character class}[rdoc-ref:Regexp@Character+Classes],
# including set negation ('[^a-z]'):
#
# Dir.glob('*.[a-z][a-z]').take(3)
# # => ["CONTRIBUTING.md", "COPYING.ja", "KNOWNBUGS.rb"]
#
- # - '{_abc_,_xyz_}':
+ # - '{abc,xyz}':
# Matches either string _abc_ or string _xyz_;
# behaves like {Regexp alternation}[rdoc-ref:Regexp@Alternation]:
#
@@ -388,10 +388,10 @@ class Dir
#
# - File::FNM_EXTGLOB:
# enables the pattern extension
- # '{_a_,_b_}', which matches pattern _a_ and pattern _b_;
+ # '{a,b}', which matches pattern _a_ and pattern _b_;
# behaves like a
# {regexp union}[rdoc-ref:Regexp.union]
- # (e.g., '(?:_a_|_b_)'):
+ # (e.g., '(?:a|b)'):
#
# pattern = '{LEGAL,BSDL}'
# Dir.glob(pattern) # => ["LEGAL", "BSDL"]
diff --git a/doc/_regexp.rdoc b/doc/_regexp.rdoc
index 301a3fe11b..aa55a7eebf 100644
--- a/doc/_regexp.rdoc
+++ b/doc/_regexp.rdoc
@@ -414,21 +414,21 @@ Each of these anchors matches a boundary:
Lookahead anchors:
-- (?=_pat_): Positive lookahead assertion:
+- (?=pat): Positive lookahead assertion:
ensures that the following characters match _pat_,
but doesn't include those characters in the matched substring.
-- (?!_pat_): Negative lookahead assertion:
+- (?!pat): Negative lookahead assertion:
ensures that the following characters do not match _pat_,
but doesn't include those characters in the matched substring.
Lookbehind anchors:
-- (?<=_pat_): Positive lookbehind assertion:
+- (?<=pat): Positive lookbehind assertion:
ensures that the preceding characters match _pat_, but
doesn't include those characters in the matched substring.
-- (?: Negative lookbehind assertion:
+- (?: Negative lookbehind assertion:
ensures that the preceding characters do not match
_pat_, but doesn't include those characters in the matched substring.
@@ -574,7 +574,7 @@ A simple regexp has (at most) one match:
re.match('1943-02-04').size # => 1
re.match('foo') # => nil
-Adding one or more pairs of parentheses, (_subexpression_),
+Adding one or more pairs of parentheses, (subexpression),
defines _groups_, which may result in multiple matched substrings,
called _captures_:
@@ -647,8 +647,8 @@ A regexp may contain any number of groups:
- For a large number of groups:
- - The ordinary \\_n_ notation applies only for _n_ in range (1..9).
- - The MatchData[_n_] notation applies for any non-negative _n_.
+ - The ordinary \\n notation applies only for _n_ in range (1..9).
+ - The MatchData[n] notation applies for any non-negative _n_.
- \0 is a special backreference, referring to the entire matched string;
it may not be used within the regexp itself,
@@ -661,7 +661,7 @@ A regexp may contain any number of groups:
As seen above, a capture can be referred to by its number.
A capture can also have a name,
-prefixed as ?<_name_> or ?'_name_',
+prefixed as ? or ?'name',
and the name (symbolized) may be used as an index in MatchData[]:
md = /\$(?\d+)\.(?'cents'\d+)/.match("$3.67")
@@ -676,7 +676,7 @@ When a regexp contains a named capture, there are no unnamed captures:
/\$(?\d+)\.(\d+)/.match("$3.67")
# => #
-A named group may be backreferenced as \k<_name_>:
+A named group may be backreferenced as \k:
/(?[aeiou]).\k.\k/.match('ototomy')
# => #
@@ -732,10 +732,10 @@ see {Atomic Group}[https://www.regular-expressions.info/atomic.html].
==== Subexpression Calls
-As seen above, a backreference number (\\_n_) or name (\k<_name_>)
+As seen above, a backreference number (\\n) or name (\k)
gives access to a captured _substring_;
the corresponding regexp _subexpression_ may also be accessed,
-via the number (\\gn) or name (\g<_name_>):
+via the number n (\\gn) or name (\g):
/\A(?\(\g*\))*\z/.match('(())')
# ^1
@@ -768,12 +768,12 @@ See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings
==== Conditionals
-The conditional construct takes the form (?(_cond_)_yes_|_no_), where:
+The conditional construct takes the form (?(cond)yes|no), where:
- _cond_ may be a capture number or name.
- The match to be applied is _yes_ if _cond_ is captured;
otherwise the match to be applied is _no_.
-- If not needed, |_no_ may be omitted.
+- If not needed, |no may be omitted.
Examples:
@@ -802,7 +802,7 @@ The absence operator is a special group that matches anything which does _not_ m
==== Unicode Properties
-The /\p{_property_name_}/ construct (with lowercase +p+)
+The /\p{property_name}/ construct (with lowercase +p+)
matches characters using a Unicode property name,
much like a character class;
property +Alpha+ specifies alphabetic characters:
@@ -1033,23 +1033,23 @@ See also {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
Each of these modifiers sets a mode for the regexp:
-- +i+: /_pattern_/i sets
+- +i+: /pattern/i sets
{Case-Insensitive Mode}[rdoc-ref:Regexp@Case-Insensitive+Mode].
-- +m+: /_pattern_/m sets
+- +m+: /pattern/m sets
{Multiline Mode}[rdoc-ref:Regexp@Multiline+Mode].
-- +x+: /_pattern_/x sets
+- +x+: /pattern/x sets
{Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
-- +o+: /_pattern_/o sets
+- +o+: /pattern/o sets
{Interpolation Mode}[rdoc-ref:Regexp@Interpolation+Mode].
Any, all, or none of these may be applied.
Modifiers +i+, +m+, and +x+ may be applied to subexpressions:
-- (?_modifier_) turns the mode "on" for ensuing subexpressions
-- (?-_modifier_) turns the mode "off" for ensuing subexpressions
-- (?_modifier_:_subexp_) turns the mode "on" for _subexp_ within the group
-- (?-_modifier_:_subexp_) turns the mode "off" for _subexp_ within the group
+- (?modifier) turns the mode "on" for ensuing subexpressions
+- (?-modifier) turns the mode "off" for ensuing subexpressions
+- (?modifier:subexp) turns the mode "on" for _subexp_ within the group
+- (?-modifier:subexp) turns the mode "off" for _subexp_ within the group
Example:
@@ -1166,22 +1166,22 @@ A regular expression containing non-US-ASCII characters
is assumed to use the source encoding.
This can be overridden with one of the following modifiers.
-- /_pat_/n: US-ASCII if only containing US-ASCII characters,
+- /pat/n: US-ASCII if only containing US-ASCII characters,
otherwise ASCII-8BIT:
/foo/n.encoding # => #
/foo\xff/n.encoding # => #
/foo\x7f/n.encoding # => #
-- /_pat_/u: UTF-8
+- /pat/u: UTF-8
/foo/u.encoding # => #
-- /_pat_/e: EUC-JP
+- /pat/e: EUC-JP
/foo/e.encoding # => #
-- /_pat_/s: Windows-31J
+- /pat/s: Windows-31J
/foo/s.encoding # => #
diff --git a/doc/language/encodings.rdoc b/doc/language/encodings.rdoc
index ee7f224f2b..683842d3fb 100644
--- a/doc/language/encodings.rdoc
+++ b/doc/language/encodings.rdoc
@@ -393,7 +393,7 @@ These keyword-value pairs specify encoding options:
- :replace: nil (default): Set replacement string to default value:
"\uFFFD" ("�") for a Unicode encoding, '?' otherwise.
- - :replace: _some_string_: Set replacement string to the given +some_string+;
+ - :replace: some_string: Set replacement string to the given +some_string+;
overrides +:fallback+.
Examples:
@@ -407,12 +407,12 @@ These keyword-value pairs specify encoding options:
One of these may be specified:
- :fallback: nil (default): No replacement fallback.
- - :fallback: _hash_like_object_: Set replacement fallback to the given
- +hash_like_object+; the replacement string is _hash_like_object_[X].
- - :fallback: _method_: Set replacement fallback to the given
- +method+; the replacement string is _method_(X).
- - :fallback: _proc_: Set replacement fallback to the given
- +proc+; the replacement string is _proc_[X].
+ - :fallback: hash_like_object: Set replacement fallback to the given
+ +hash_like_object+; the replacement string is hash_like_object[X].
+ - :fallback: method: Set replacement fallback to the given
+ +method+; the replacement string is method(X).
+ - :fallback: proc: Set replacement fallback to the given
+ +proc+; the replacement string is proc[X].
Examples:
diff --git a/doc/language/globals.md b/doc/language/globals.md
index 83a024b141..ece950d3d8 100644
--- a/doc/language/globals.md
+++ b/doc/language/globals.md
@@ -21,16 +21,16 @@ require 'English'
### Matched \Data
-| Variable | \English | Contains | Initially | Read-Only | Reset By |
-|:-------------:|:-------------------:|-----------------------------------|:---------:|:---------:|-----------------|
-| `$~` | `$LAST_MATCH_INFO` | \MatchData object or `nil` | `nil` | No | Matcher methods |
-| `$&` | `$MATCH` | Matched substring or `nil` | `nil` | No | Matcher methods |
-| `` $` `` | `$PRE_MATCH` | Substring left of match or `nil` | `nil` | No | Matcher methods |
-| `$'` | `$POST_MATCH` | Substring right of match or `nil` | `nil` | No | Matcher methods |
-| `$+` | `$LAST_PAREN_MATCH` | Last group matched or `nil` | `nil` | No | Matcher methods |
-| `$1` | | First group matched or `nil` | `nil` | Yes | Matcher methods |
-| `$2` | | Second group matched or `nil` | `nil` | Yes | Matcher methods |
-| $_n_ | | nth group matched or `nil` | `nil` | Yes | Matcher methods |
+| Variable | \English | Contains | Initially | Read-Only | Reset By |
+|:---------:|:-------------------:|-----------------------------------|:---------:|:---------:|-----------------|
+| `$~` | `$LAST_MATCH_INFO` | \MatchData object or `nil` | `nil` | No | Matcher methods |
+| `$&` | `$MATCH` | Matched substring or `nil` | `nil` | No | Matcher methods |
+| `` $` `` | `$PRE_MATCH` | Substring left of match or `nil` | `nil` | No | Matcher methods |
+| `$'` | `$POST_MATCH` | Substring right of match or `nil` | `nil` | No | Matcher methods |
+| `$+` | `$LAST_PAREN_MATCH` | Last group matched or `nil` | `nil` | No | Matcher methods |
+| `$1` | | First group matched or `nil` | `nil` | Yes | Matcher methods |
+| `$2` | | Second group matched or `nil` | `nil` | Yes | Matcher methods |
+| `$n` | | nth group matched or `nil` | `nil` | Yes | Matcher methods |
### Separators
@@ -167,7 +167,7 @@ English - `$LAST_PAREN_MATCH`.
### `$1`, `$2`, \Etc. (Matched Group)
-For $_n_ the nth group of the match.
+For $n the nth group of the match.
No \English.
@@ -282,9 +282,9 @@ by Kernel#load and Kernel#require.
Singleton method `$LOAD_PATH.resolve_feature_path(feature)`
returns:
-- [:rb, _path_], where `path` is the path to the Ruby file to be
+- [:rb, path], where `path` is the path to the Ruby file to be
loaded for the given `feature`.
-- [:so, _path_], where `path` is the path to the shared object file
+- [:so, path], where `path` is the path to the shared object file
to be loaded for the given `feature`.
- `nil` if there is no such `feature` and `path`.
diff --git a/file.c b/file.c
index 867b041a44..809253fab0 100644
--- a/file.c
+++ b/file.c
@@ -7963,11 +7963,11 @@ Init_File(void)
*
* ==== File::FNM_EXTGLOB
*
- * Flag File::FNM_EXTGLOB enables pattern '{_a_,_b_}',
+ * Flag File::FNM_EXTGLOB enables pattern '{a,b}',
* which matches pattern '_a_' and pattern '_b_';
* behaves like
* a {regexp union}[rdoc-ref:Regexp.union]
- * (e.g., '(?:_a_|_b_)'):
+ * (e.g., '(?:a|b)'):
*
* pattern = '{LEGAL,BSDL}'
* Dir.glob(pattern) # => ["LEGAL", "BSDL"]
diff --git a/test/ruby/sentence.rb b/test/ruby/sentence.rb
index 9bfd7c7599..99ced05d2f 100644
--- a/test/ruby/sentence.rb
+++ b/test/ruby/sentence.rb
@@ -211,7 +211,7 @@ class Sentence
# returns new sentence object which
# _target_ is substituted by the block.
#
- # Sentence#subst invokes _target_ === _string_ for each
+ # Sentence#subst invokes target === string for each
# string in the sentence.
# The strings which === returns true are substituted by the block.
# The block is invoked with the substituting string.