3 ms·
I’ve implemented glob matchers by regex-replacing the glob pattern, turning it into a regex, and then using that regex. I wonder how that would have gone in an
by layer8 4y ago
I’ve implemented glob matchers by regex-replacing the glob pattern, turning it into a regex, and then using that regex. I wonder how that would have gone in an interview. :)
- burntsushi 4y agoThis is actually how glob matching is currently implemented in ripgrep: https://github.com/BurntSushi/ripgrep/blob/a9d97a1dda0a07a8e55b2aa9b95690a4634e4874/crates/globset/src/glob.rs#L638-L733 https://github.com/BurntSushi/ripgrep/blob/a9d97a1dda0a07a8e... Works quite well because it can take advantage of the host of optimizations inside the regex engine.