📜  JS glob 到正则表达式 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:27.748000             🧑  作者: Mango

代码示例1
// Rudimentary code for matching globs with ? and *
// Escape the dots, change * to .* and ? to . 
// and make it match entire string
new RegExp
(
  '^' +
  rx.replaceAll('\.', '\\.')
  .replaceAll('*', '.*')
  .replaceAll('?', '.') +
  '$'
)