# grep Pattern Builder

Build a grep command with the right regex style, recursion, includes and context lines, then copy it.

- Category: Text (text)
- URL: https://ilham.dev/tools/grep-pattern-builder/
- Documentation: https://ilham.dev/tools/grep-pattern-builder/index.md
- Keywords: grep, search, pattern, regex, command, builder, recursive, include, context, text, shell

## Example questions

- When should I use -F?
- What is the difference between -E and -P?
- How do I pass several extensions?

## Properties

- Runs in the browser
- No login required
- No data uploaded


## About

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.


## 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.

