path: root/doc/regexp.rdoc
diff options
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-25 01:36:05 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-25 01:36:05 +0000
commit71c4c0b9e73b1df474736efad3b4a41ff51e009d (patch)
tree66adfee3844ff6ba87785a672d50b082ab7ffc4e /doc/regexp.rdoc
parentb09c01eff0b409e665d34d062c169b8f368cc51c (diff)
* doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
[Fixes GH-606] [ci skip] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc/regexp.rdoc')
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index 29435a9..810f15c 100644
--- a/doc/regexp.rdoc
+++ b/doc/regexp.rdoc
@@ -558,8 +558,11 @@ A contrived pattern to match a number with optional decimal places:
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