Project

General

Profile

Misc #10836 ยป 0001-adding-documentation-for-non-subexp-option-toggling.patch

tom-lord (Tom Lord), 02/07/2015 11:44 PM

View differences:

doc/regexp.rdoc
subexpression level with the
<tt>(?</tt><i>on</i><tt>-</tt><i>off</i><tt>)</tt> construct, which
enables options <i>on</i>, and disables options <i>off</i> for the
expression enclosed by the parentheses.
expression enclosed by the parentheses:
/a(?i:b)c/.match('aBc') #=> #<MatchData "aBc">
/a(?i:b)c/.match('abc') #=> #<MatchData "abc">
/a(?i:b)c/.match('aBc') #=> #<MatchData "aBc">
/a(?-i:b)c/i.match('ABC') #=> nil
Additionally, these options can also be toggled for the remainder of the
pattern:
/a(?i)bc/.match('abC') #=> #<MatchData "abC">
Options may also be used with <tt>Regexp.new</tt>:
    (1-1/1)