3 ms·
But in general the reversal of a glob pattern is trivial while the reversal of the equivalent regular expression is not, no?
by maweki 10y ago
But in general the reversal of a glob pattern is trivial while the reversal of the equivalent regular expression is not, no?
- rsc 10y agoReversing a regular expression and reversing a glob are about the same: you just flip everything around and you're done. In fact RE2 uses this fact to speed up regexp searches. See https://swtch.com/~rsc/regexp/regexp3.html#submatch https://swtch.com/~rsc/regexp/regexp3.html#submatch and scan ahead a bit for "Run the DFA backward".