5.5.2 Full versus Partial Regexp Matching
By default, a regexp matches an input string only when it matches the entire string.
RXMatch("x", [], {})
#false
A match to only part of the input can be enabled in either of two ways: by using rx_in to create the regexp, or by using the RX.match_in method to match to input. Using both rx_in and RX.match_in has the same effect as using only one of them. A partial match locates the the earliest point in the input where a successful match can start.
RXMatch("x", [], {})
RXMatch("yx", [], {})
The bof and eof pattern operators explicitly match the beginning or end of an input. A pattern that uses those operators at the start and end will match the same with rx, rx_in, RX.match and RX.match_in.
#false
The bol and eol operators match the start or end of a line, which includes the start and end of an input, but also includes the positions just after and just before a newline character.
#false
RXMatch("x", [], {})
RXMatch("y", [], {})
For partial matches or for locating capture groups within an input, RX.match_range and RX.match_range_in return a Range for each match, instead of the matching characters.
> rx'any "x"'.match_range_in("xyx")
RXMatch(1 .. 3, [], {})
RXMatch(0 .. 7, [4 .. 5], {#'between: 1})