mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[Feature #18788] [DOC] String options to Regexp.new
Co-Authored-By: Janosch Müller <janosch.mueller@betterplace.org>
This commit is contained in:
parent
883d13dc41
commit
4a6facc2d6
Notes:
git
2022-06-20 19:35:33 +09:00
2 changed files with 10 additions and 0 deletions
|
@ -620,6 +620,11 @@ Options may also be used with <tt>Regexp.new</tt>:
|
|||
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 <tt>x</tt> option enables <i>free-spacing</i>
|
||||
|
|
5
re.c
5
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:
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue