we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "js glob to regex"
Marlon
14 Feb 2017
1// Rudimentary code for matching globs with ? and *
2// Escape the dots, change * to .* and ? to . 
3// and make it match entire string
4new RegExp
5(
6  '^' +
7  rx.replaceAll('\.', '\\.')
8  .replaceAll('*', '.*')
9  .replaceAll('?', '.') +
10  '$'
11)