summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/regexp.rdoc7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index 29435a96d7..810f15ce1a 100644
--- a/doc/regexp.rdoc
+++ b/doc/regexp.rdoc
@@ -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