Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/_regexp.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ A regexp may be used:
re.match('good') # => nil

See sections {Method match}[rdoc-ref:Regexp@Method+match]
and {Operator =~}[rdoc-ref:Regexp@Operator+-3D~].
and {Operator =~}[rdoc-ref:Regexp@Operator-].

- To determine whether a string matches a given pattern:

re.match?('food') # => true
re.match?('good') # => false

See section {Method match?}[rdoc-ref:Regexp@Method+match-3F].
See section {Method match?}[rdoc-ref:Regexp@Method+match].

- As an argument for calls to certain methods in other classes and modules;
most such methods accept an argument that may be either a string
Expand Down Expand Up @@ -64,7 +64,7 @@ A regular expression may be created with:
/foo/ # => /foo/

- A <tt>%r</tt> regexp literal
(see {%r: Regexp Literals}[rdoc-ref:syntax/literals.rdoc@25r-3A+Regexp+Literals]):
(see {%r: Regexp Literals}[rdoc-ref:syntax/literals.rdoc@r-regexp+literals]):

# Same delimiter character at beginning and end;
# useful for avoiding escaping characters
Expand Down Expand Up @@ -113,7 +113,7 @@ none sets {global variables}[rdoc-ref:Regexp@Global+Variables]:
Certain regexp-oriented methods assign values to global variables:

- <tt>#match</tt>: see {Method match}[rdoc-ref:Regexp@Method+match].
- <tt>#=~</tt>: see {Operator =~}[rdoc-ref:Regexp@Operator+-3D~].
- <tt>#=~</tt>: see {Operator =~}[rdoc-ref:Regexp@Operator-].

The affected global variables are:

Expand Down Expand Up @@ -561,9 +561,9 @@ Quantifier matching may be greedy, lazy, or possessive:
More:

- About greedy and lazy matching, see
{Choosing Minimal or Maximal Repetition}[https://doc.lagout.org/programmation/Regular%20Expressions/Regular%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Programming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-09-06%5D.pdf#tutorial-backtrack].
{Choosing Minimal or Maximal Repetition}[https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch02s13.html].
- About possessive matching, see
{Eliminate Needless Backtracking}[https://doc.lagout.org/programmation/Regular%20Expressions/Regular%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Programming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-09-06%5D.pdf#tutorial-backtrack].
{Eliminate Needless Backtracking}[https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch02s14.html].

=== Groups and Captures

Expand Down Expand Up @@ -764,7 +764,7 @@ The pattern:
9. Matches the fourth character in the string, <tt>')'</tt>.
10. Matches the end of the string.

See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings-and-backreferences.html?highlight=subexpression#subexpression-calls].
See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings-and-backreferences.html#subexpression-calls].

==== Conditionals

Expand Down
33 changes: 18 additions & 15 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1913,26 +1913,27 @@ rb_mod_eqq(VALUE mod, VALUE arg)

/*
* call-seq:
* mod <= other -> true, false, or nil
* self <= other -> true, false, or nil
*
* Returns +true+ if +self+ is a descendant of +other+
* (+self+ is a subclass of +other+ or +self+ includes +other+) or
* if +self+ is the same as +other+:
* Compares +self+ and +other+ with respect to ancestry and inclusion.
*
* Float <= Numeric # => true
* Array <= Enumerable # => true
* Float <= Float # => true
* Returns +nil+ if there is no such relationship between the two:
*
* Returns +false+ if +self+ is an ancestor of +other+
* (+self+ is a superclass of +other+ or +self+ is included in +other+):
* Array <= Hash # => nil
*
* Numeric <= Float # => false
* Enumerable <= Array # => false
* Otherwise, returns +true+ if +other+ is an ancestor of +self+,
* or if +self+ includes +other+,
* or if the two are the same:
*
* Returns +nil+ if there is no relationship between the two:
* File <= IO # => true # IO is an ancestor of File.
* Array <= Enumerable # => true # Array includes Enumerable.
* Array <= Array # => true
*
* Otherwise, returns +false+:
*
* IO <= File # => false
* Enumerable <= Array # => false
*
* Float <= Hash # => nil
* Enumerable <= String # => nil
*/

VALUE
Expand Down Expand Up @@ -2011,7 +2012,9 @@ rb_mod_lt(VALUE mod, VALUE arg)

/*
* call-seq:
* mod >= other -> true, false, or nil
* self >= other -> true, false, or nil
*
* Compares +self+ and +other+ with respect to ancestry and inclusion.
*
* Returns +true+ if +self+ is an ancestor of +other+
* (+self+ is a superclass of +other+ or +self+ is included in +other+) or
Expand Down