Last active
April 2, 2021 23:48
-
-
Save waptik/565f9ec9bbb798c90a581b5e4b098152 to your computer and use it in GitHub Desktop.
regex to filter bot command and args
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
// ref https://flaviocopes.com/javascript-regular-expressions | |
const re=/(?<code>(c|g)_\w+)(.)(?<to>to)(.)(?<id>id\d+)/ | |
console.log(re.exec("c_84www to id890890")) // returns ["c_84www to id890890", "c_84www", "c", " ", "to", " ", "id890890", index: 0, input: "c_84www to id890890", groups: {code: "c_84www", to: "to", id: "id890890"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment