Created
January 24, 2017 03:45
-
-
Save Zetaphor/97dabc982abdbc940998aa455fc4fa41 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
const regex = /^(?:https?:\/\/w*\.?)?([a-zA-Z0-9\.\-_]+)(?:[\/.\-_a-zA-Z0-9]*)$/; | |
const str = `https://test.google.com/testdsadsa`; | |
let m; | |
if ((m = regex.exec(str)) !== null) { | |
// The result can be accessed through the `m`-variable. | |
m.forEach((match, groupIndex) => { | |
console.log(`Found match, group ${groupIndex}: ${match}`); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment