ruby-changes:34015
From: zzak <ko1@a...>
Date: Sun, 25 May 2014 10:36:11 +0900 (JST)
Subject: [ruby-changes:34015] zzak:r46096 (trunk): * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
zzak 2014-05-25 10:36:05 +0900 (Sun, 25 May 2014) New Revision: 46096 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=46096 Log: * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex [Fixes GH-606] https://github.com/ruby/ruby/pull/606 [ci skip] Modified files: trunk/ChangeLog trunk/doc/regexp.rdoc Index: doc/regexp.rdoc =================================================================== --- doc/regexp.rdoc (revision 46095) +++ doc/regexp.rdoc (revision 46096) @@ -558,8 +558,11 @@ A contrived pattern to match a number wi https://github.com/ruby/ruby/blob/trunk/doc/regexp.rdoc#L558 \Z/x float_pat.match('3.14') #=> #<MatchData "3.14" 1:".14"> -*Note*: To match whitespace in an <tt>x</tt> pattern use an escape such as -<tt>\s</tt> or <tt>\p{Space}</tt>. +There are a number of strategies for matching whitespace: + +* Use a pattern such as <tt>\s</tt> or <tt>\p{Space}</tt>. +* Use escaped whitespace such as <tt>\ </tt>, i.e. a space preceded by a backslash. +* Use a character class such as <tt>[ ]</tt>. Comments can be included in a non-<tt>x</tt> pattern with the <tt>(?#</tt><i>comment</i><tt>)</tt> construct, where <i>comment</i> is Index: ChangeLog =================================================================== --- ChangeLog (revision 46095) +++ ChangeLog (revision 46096) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun May 25 10:34:15 2014 Zachary Scott <e@z...> + + * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex + [Fixes GH-606] https://github.com/ruby/ruby/pull/606 + Sun May 25 10:19:34 2014 Zachary Scott <e@z...> * enum.c: [DOC] Use #find in example to clarify alias by @rachellogie -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/