Skip to content

Instantly share code, notes, and snippets.

@tofusoup429
Created July 30, 2020 05:45
Show Gist options
  • Save tofusoup429/70d275a436f13c3093a8c6f774172c6f to your computer and use it in GitHub Desktop.
Save tofusoup429/70d275a436f13c3093a8c6f774172c6f to your computer and use it in GitHub Desktop.
//extract more information for substring that matches exampleString.
const regexPattern=/\s+[0-9]+-[0-9]+-[0-9]+\s+/;
const exampleString =
"Hi~ call me this number 093-5353-6234 after" +
" 4:30 pm or email me at tofusoup429@gmail.com anytime.";
const result2 = regexPattern.exec(exampleString);
console.log("output: ",result2);
/*output: [
' 093-5353-6234 ',
index: 23,
input: 'Hi~ call me this number 093-5353-6234 after 4:30 pm or email me at tofusoup429@gmail.com anytime.',
groups: undefined
]*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment