Universal grep

Search source code files more efficiently using modern options for powerful pattern matching.

What is ugrep?

ugrep is in many ways the best grep tool, offering powerful pre-defined search patterns and quick options to selectively search source code files efficiently in large directory trees.

ugrep makes it easy to search source code files. For example to find exact matches of "main" in C/C++ source code files located in the myprojects directory, while skipping strings and comments that may have a match with "main" in them:

ugrep -r -o -tc,c++ -w 'main' -f patterns/c_zap_strings -f patterns/c_zap_comments myproject

ugrep uses RE/flex for high-performance regex matching, which is 100 times faster than the GNU C POSIX.2 regex library used by the grep utility and 10 times faster than PCRE2 and RE2.

ugrep matches Unicode regex patterns. The regular expression syntax is POSIX ERE compliant, extended with Unicode character classes, lazy quantifiers, and negative patterns to skip unwanted pattern matches to produce more precise results.

ugrep searches UTF-encoded input whe UTF BOM (byte order mark) are present and ASCII and UTF-8 when no UTF BOM is present. Option --file-format permits many other file formats to be searched, such as ISO-8859-1, EBCDIC, and code pages 437, 850, 858, 1250 to 1258.

ugrep offers command-line options compatible with the popular GNU grep utility. ugrep is free open source licensed under the BSD-3.

Best of all, ugrep lives on GitHub!