Last active
January 24, 2018 10:13
-
-
Save pointcom/0421e1d6b34674898942c8e854c831bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://ruby-doc.org/core-2.5.0/MatchData.html#method-i-named_captures | |
# Ruby >= 2.4 | |
/(?<first_name>.+) (?<last_name>.+)/.match('Bobby Brown').named_captures | |
=> {"first_name"=>"Bobby", "last_name"=>"Brown"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment