function convertPathExpressionToRegExp(path) {
  if (!path || path === '/') return /.*/;
  const escapedPath = path
    .split('*')
    .map(part => part.replace(/([-[\]{}()*+?.,\\^|#\s])/g, '\\$1'))
    .join('.*');
  return new RegExp(`https?://[^/]+${escapedPath}`);
}
@param {string|undefined} path
@return {RegExp}