Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Last active October 2, 2020 15:02
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 umutyerebakmaz/08fa92ae7bb97a1afb6aff2ca8631881 to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/08fa92ae7bb97a1afb6aff2ca8631881 to your computer and use it in GitHub Desktop.
Regex startWith
startWith(str: string, url: string): boolean {
const patt = new RegExp('(' + str +')');
const res = patt.test(url);
return res;
}
this.startWith('/admin/depos/update', event.url)
// str: '/admin/depos/update'
// event.url: /admin/depos/update/3016599b-f0a1-4520-b42b-7f234a008849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment