From 71c4c0b9e73b1df474736efad3b4a41ff51e009d Mon Sep 17 00:00:00 2001 From: zzak Date: Sun, 25 May 2014 01:36:05 +0000 Subject: * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex [Fixes GH-606] https://github.com/ruby/ruby/pull/606 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- doc/regexp.rdoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'doc/regexp.rdoc') 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') #=> # -*Note*: To match whitespace in an x pattern use an escape such as -\s or \p{Space}. +There are a number of strategies for matching whitespace: + +* Use a pattern such as \s or \p{Space}. +* Use escaped whitespace such as \ , i.e. a space preceded by a backslash. +* Use a character class such as [ ]. Comments can be included in a non-x pattern with the (?#comment) construct, where comment is -- cgit v1.2.3