davincicoders/ruby_koans_RKB1923 — pull request #9 by RKB1923 (2014-03-07 01:04:27+00:00)
Title: Fixes 65851412_about_regular_expressions_master

* Learned a lot about regular expressions!
* Any pattern specified within forward slashes (/) is a regular expression
* You can use [ ] to match for a pattern (a failed match returns nil)
* ? means an optional match
* + means one or more matches
* Asterisks (*) mean zero or more matches
* The leftmost wins
* Character classes specified with square brackets [ ] can match for a character
* \d is a digit match
* Ranges like 0-9 can be used
* \s is a match for a whitespace character
* \w matches words
* Periods . are matches for any non-newline character
* You can negate a character class with a caret or any of the shortcut character classes by capitalizing them
* \A anchors to the start of the string, while \z anchors to the end of a string
* Carets ^ can also be used to actor to the start of lines, while the $ anchors to the end of lines
* \b anchors to a word boundary
* Parentheses () group contents and can capture matched content by number (like an index)
* Variables can be used to access captures
* The vertical pipe means "or"
* .scan method is used to find all matches
* .sub is like find and replace the first instance
* .gsub is like find and replace all

[#65851412]