diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc index 2b6a870026..f3844d5729 100644 --- a/doc/regexp.rdoc +++ b/doc/regexp.rdoc @@ -620,6 +620,11 @@ Options may also be used with Regexp.new: Regexp.new("abc # Comment", Regexp::EXTENDED) #=> /abc # Comment/x Regexp.new("abc", Regexp::IGNORECASE | Regexp::MULTILINE) #=> /abc/mi + Regexp.new("abc", "i") #=> /abc/i + Regexp.new("abc", "m") #=> /abc/m + Regexp.new("abc # Comment", "x") #=> /abc # Comment/x + Regexp.new("abc", "im") #=> /abc/mi + == Free-Spacing Mode and Comments As mentioned above, the x option enables free-spacing diff --git a/re.c b/re.c index 39d4fc046f..3e059b6287 100644 --- a/re.c +++ b/re.c @@ -3665,6 +3665,11 @@ str_to_option(VALUE str) * * Optional argument +options+ is one of the following: * + * - A String of options: + * + * Regexp.new('foo', 'i') # => /foo/i + * Regexp.new('foo', 'im') # => /foo/im + * * - The logical OR of one or more of the constants * Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE: *