sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Parslet.match

Returns an atom matching a character class. All regular expressions can be
used, as long as they match only a single character at a time. 

  match('[ab]')     # will match either 'a' or 'b'
  match('[\n\s]')   # will match newlines and spaces

There is also another (convenience) form of this method: 

  match['a-z']      # synonymous to match('[a-z]')
  match['\n']       # synonymous to match('[\n]')

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/parslet/lib/parslet.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Parslet-match-for-pr


# Commit to git

git add app/server/ruby/vendor/parslet/lib/parslet.rbgit commit -m "better docs for Parslet.match"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Parslet-match-for-pr

hub pull-request


# Celebrate!