JS glob to regex

JavaScript
// 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('?', '.') +
  '$'
)
Source

Also in JavaScript: