RegexQuery constructor
- String rawQuery, {
- SearchTarget target = SearchTarget.signals,
Create a regex query from rawQuery.
A standalone * is converted to .*, ? to .. The segment
** matches zero or more hierarchy levels.
Implementation
RegexQuery(
super.rawQuery, {
super.target = SearchTarget.signals,
}) : super(crossesBoundaries: false) {
final parts = rawQuery
.split(hierarchyPathSeparator)
.map((s) => s.trim())
.where((s) => s.isNotEmpty)
.toList();
segments = parts.map((s) {
if (s == '**') {
return RegexSegment.globStar();
}
final pattern = _globToRegex(s);
return RegexSegment(RegExp('^$pattern\$'));
}).toList();
}