Skip to content

Commit

Permalink
* doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
Browse files Browse the repository at this point in the history
  [Fixes rubyGH-606] ruby#606 [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
zzak committed May 25, 2014
1 parent b09c01e commit 71c4c0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Sun May 25 10:34:15 2014 Zachary Scott <e@zzak.io>

* 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@zzak.io>

* enum.c: [DOC] Use #find in example to clarify alias by @rachellogie
Expand Down
7 changes: 5 additions & 2 deletions doc/regexp.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,11 @@ A contrived pattern to match a number with optional decimal places:
\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
Expand Down

0 comments on commit 71c4c0b

Please sign in to comment.