3 ms·
Grep is a regex capable search. re is more powerful than grep. Python supports "grepping" via re.search. Absolutely is grep. If you need a shell tool to search
by CableNinja 3y ago
Grep is a regex capable search. re is more powerful than grep. Python supports "grepping" via re.search.
Absolutely is grep. If you need a shell tool to search for something in a python script, youre doin it entirely wrong
- burntsushi 3y agoA simple loop over lines using Python's `re` package is unlikely to be as fast as an optimized grep. If your inputs are small, the difference might be negligible. But if they're large, the difference might be enormous. And that's not even accounting for just regex engine throughput on its own. ripgrep for example uses rust/regex. Compare its performance with python/re: https://github.com/BurntSushi/rebar#summary-of-search-time-benchmarks https://github.com/BurntSushi/rebar#summary-of-search-time-b...