Last active
April 30, 2016 01:57
-
-
Save jdx/8d5171b511a0f01bf467 to your computer and use it in GitHub Desktop.
JS ES6 Destructurin' with Regex
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
// node 6 | |
let msg = "Merge pull request #222 from heroku/api-key-warning-whoami show warning if HEROKU_API_KEY is set" | |
let [, pr, branch, message] = msg.match(/Merge pull request (#\d+) from ([\S]+) (.*)/) | |
// node 5 | |
let msg = "Merge pull request #222 from heroku/api-key-warning-whoami show warning if HEROKU_API_KEY is set" | |
let matches = msg.match(/Merge pull request (#\d+) from ([\S]+) (.*)/) | |
let pr = matches[1] | |
let branch = matches[2] | |
let messages = matches[3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment