Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Improve docs on whitespace with Regexp::EXTENDED #606

Closed
wants to merge 1 commit into from

2 participants

@allolex
  • Change existing note on whitespace into a bullet point
  • Add info about escaping literal whitespace: \
  • Add info about using character classes with whitespace: [ ]
@allolex allolex Add more docs for whitespace in Regexp
- Change existing note on whitespace

- Add info about escaping spaces and character classes
aedbccb
@allolex

@zzak When you get the chance, could you have a look for this. I'm happy to amend as needed.

@zzak zzak closed this pull request from a commit
@zzak zzak * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
  [Fixes GH-606] #606 [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
71c4c0b
@zzak zzak closed this in 71c4c0b
@zzak
Collaborator

@allolex Thanks!

@mmasaki mmasaki referenced this pull request from a commit in mmasaki/ruby
@zzak zzak * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
  [Fixes GH-606] ruby#606 [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ffb5ead
@dapplebeforedawn dapplebeforedawn referenced this pull request from a commit in covermymeds/ruby
@zzak zzak * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
  [Fixes GH-606] ruby#606 [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
8379194
@gam3 gam3 referenced this pull request from a commit
@zzak zzak * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
  [Fixes GH-606] #606 [ci skip]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
5e3c5b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2014
  1. @allolex

    Add more docs for whitespace in Regexp

    allolex authored
    - Change existing note on whitespace
    
    - Add info about escaping spaces and character classes
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 2 deletions.
  1. +5 −2 doc/regexp.rdoc
View
7 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
Something went wrong with that request. Please try again.