grep Pattern Builder Guide
Build a grep command with the right regex style, recursion, includes and context lines, then copy it.
A short companion for grep Pattern Builder: when it is useful, what it expects, and what to check before using the result.
What it does
Put together a grep command with the right regex flavour and the flags that keep the output readable. Pick extended, basic, fixed or Perl patterns, choose recursion, case, line numbers, context and file filters, and the page builds the command with the pattern safely quoted.
Use the tool
Open grep Pattern Builder, add the input the tool asks for, run it, and check the output before using it elsewhere.
Input and output
- Input: text.
- Output: text.
- Category: Text.
Privacy and processing
Processing happens locally in your browser. This tool does not upload the input to ilham.dev.
Questions
When should I use -F?
When you are searching for literal text that contains regex characters, such as an IP address with dots or a string with brackets. -F treats the pattern as plain text, so nothing needs escaping.
What is the difference between -E and -P?
-E uses POSIX extended regular expressions, which are portable and cover word boundaries, groups and alternation. -P uses PCRE for lookaround and lazy quantifiers, but it is a GNU feature and not available on every system.
How do I pass several extensions?
Type one include pattern at a time, or a shell expansion such as a brace list you write yourself. The builder writes one --include for whatever you enter.
Related guide
For broader background, see Linux Command Line Tasks Without Surprises.