summaryrefslogtreecommitdiff
path: root/doc/regexp.rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/regexp.rdoc')
-rw-r--r--doc/regexp.rdoc11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index 06c730058d..9218a75b67 100644
--- a/doc/regexp.rdoc
+++ b/doc/regexp.rdoc
@@ -541,10 +541,15 @@ options which control how the pattern can match.
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>: