зеркало из https://github.com/github/ruby.git
Improve doc of Regexp about "ignore case" behavior [Misc #10836]
* doc/regexp.rdoc: RDoc for "ignore case" behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a87e4d9208
Коммит
fdbc8eed42
|
@ -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/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>:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче