Skip to content

Instantly share code, notes, and snippets.

@zsytssk
Last active August 18, 2018 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsytssk/a60b1d89d9b534f18241fc62c7653147 to your computer and use it in GitHub Desktop.
Save zsytssk/a60b1d89d9b534f18241fc62c7653147 to your computer and use it in GitHub Desktop.
regex match all
const text = `TypeScript lets you write JavaScript the way you really want to.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
ANY browser. ANY host. ANY OS. Open Source.
`;
const pattern = /\b[A-Z]{2,}\b/g;
let m;
while (m = pattern.exec(text)) {
console.log(m)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment