Created
August 31, 2020 17:04
-
-
Save ashwinkumar2438/21c8d4e5b6c7c9082d72e5b5fd8fa2db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var regex=/(?<circle>\d{2})(?<district>\d)[\s-]?(?<office>\d{3})/; | |
console.log(regex.exec("412207").groups); //{circle: "41", district: "2", office: "207"} | |
console.log(regex.exec("182-101").groups); //{circle: "18", district: "2", office: "101"} | |
console.log(regex.exec("224 123").groups); //{circle: "22", district: "4", office: "123"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment