[前][次][番号順一覧][スレッド一覧]

ruby-changes:24689

From: drbrain <ko1@a...>
Date: Tue, 21 Aug 2012 05:19:32 +0900 (JST)
Subject: [ruby-changes:24689] drbrain:r36740 (trunk): * re.c (rb_reg_initialize_m): Update example to show that regexp

drbrain	2012-08-21 05:19:21 +0900 (Tue, 21 Aug 2012)

  New Revision: 36740

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36740

  Log:
    * re.c (rb_reg_initialize_m):  Update example to show that regexp
      options use | an not || to avoid confusion.

  Modified files:
    trunk/ChangeLog
    trunk/re.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36739)
+++ ChangeLog	(revision 36740)
@@ -1,3 +1,8 @@
+Tue Aug 21 05:18:03 2012  Eric Hodel  <drbrain@s...>
+
+	* re.c (rb_reg_initialize_m):  Update example to show that regexp
+	  options use | an not || to avoid confusion.
+
 Mon Aug 20 23:02:27 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y: more descriptive token names in syntax error messages.
Index: re.c
===================================================================
--- re.c	(revision 36739)
+++ re.c	(revision 36740)
@@ -2877,20 +2877,21 @@
  *     Regexp.compile(string, [options [, lang]])    -> regexp
  *     Regexp.compile(regexp)                        -> regexp
  *
- *  Constructs a new regular expression from <i>pattern</i>, which can be either
- *  a <code>String</code> or a <code>Regexp</code> (in which case that regexp's
- *  options are propagated, and new options may not be specified (a change as of
- *  Ruby 1.8). If <i>options</i> is a <code>Fixnum</code>, it should be one or
- *  more of the constants <code>Regexp::EXTENDED</code>,
- *  <code>Regexp::IGNORECASE</code>, and <code>Regexp::MULTILINE</code>,
- *  <em>or</em>-ed together. Otherwise, if <i>options</i> is not
- *  <code>nil</code>, the regexp will be case insensitive.
- *  When the <i>lang</i> parameter is `n' or `N' sets the regexp no encoding.
+ *  Constructs a new regular expression from +pattern+, which can be either a
+ *  String or a Regexp (in which case that regexp's options are propagated),
+ *  and new options may not be specified (a change as of Ruby 1.8).
  *
+ *  If +options+ is a Fixnum, it should be one or more of the constants
+ *  Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE,
+ *  <em>or</em>-ed together.  Otherwise, if +options+ is not
+ *  +nil+ or +false+, the regexp will be case insensitive.
+ *
+ *  When the +lang+ parameter is `n' or `N' sets the regexp no encoding.
+ *
  *     r1 = Regexp.new('^a-z+:\\s+\w+')           #=> /^a-z+:\s+\w+/
  *     r2 = Regexp.new('cat', true)               #=> /cat/i
- *     r3 = Regexp.new('dog', Regexp::EXTENDED)   #=> /dog/x
- *     r4 = Regexp.new(r2)                        #=> /cat/i
+ *     r3 = Regexp.new(r2)                        #=> /cat/i
+ *     r4 = Regexp.new('dog', Regexp::EXTENDED | Regexp::IGNORECASE) #=> /dog/x
  */
 
 static VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]