From ee3c3b4a36708a279dda7eb848b4aa765f771003 Mon Sep 17 00:00:00 2001 From: Tom Lord Date: Sat, 7 Feb 2015 23:27:41 +0000 Subject: [PATCH] adding documentation for non-subexp option toggling --- doc/regexp.rdoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc index 810f15c..c41bdc3 100644 --- a/doc/regexp.rdoc +++ b/doc/regexp.rdoc @@ -528,10 +528,15 @@ options which control how the pattern can match. subexpression level with the (?on-off) construct, which enables options on, and disables options off for the -expression enclosed by the parentheses. +expression enclosed by the parentheses: - /a(?i:b)c/.match('aBc') #=> # - /a(?i:b)c/.match('abc') #=> # + /a(?i:b)c/.match('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') #=> # Options may also be used with Regexp.new: -- 1.9.1