GlobMatcher.compile constructor

GlobMatcher.compile(
  1. String pattern
)

Compiles a glob pattern into a GlobMatcher.

Supported syntax:

  • * matches any characters except /
  • ** matches any characters including /
  • ? matches exactly one character except /
  • [abc] character class
  • {a,b} alternation

Implementation

factory GlobMatcher.compile(String pattern) {
  final regex = _globToRegex(pattern);
  return GlobMatcher._(pattern, RegExp('^$regex\$'));
}