Text & String Utilities100% Client-Side

Filter Text Lines with Regular Expressions

Paste text and use a regular expression to select the lines you want to keep. Each line is tested independently, and the output includes the complete matching line. Enter flags separately when the pattern should ignore case or use another JavaScript matching option. You can also invert the result to keep the lines that fail the test, without changing their original order.

Configuration Options
Input
23 chars•3 lines
Output

How to Use the Grep Lines Online with a Regex Pattern

  1. 1Paste the text to search with one candidate line per row.
  2. 2Enter the pattern in Regex Pattern and put any flags in their separate field.
  3. 3Enable Invert Match when you want to exclude the lines that satisfy the pattern.
  4. 4Review the returned lines and correct the pattern if the tool reports a syntax error.

Input & Output Examples

Use a backslash before the dot, a dollar sign for the end, and i for case-insensitive matching.

Input Sample
cover.PNG
notes.txt
map.png
Expected Output
cover.PNG
map.png

With inversion on, the pattern anchored at both ends excludes lines containing digits only.

Input Sample
42
007
row 8
Expected Output
row 8

Practical Developer Workflows

  • Select filenames ending in a chosen extension from a plain-text list.
  • Keep only records that begin with a specific label while retaining their full contents.
  • Exclude rows made entirely of digits from a mixed text fixture.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

Enter the pattern itself and put flags such as i in the separate field. For example, use a backslash before the dot in a filename extension. Wrapping the pattern in slashes would make those slashes part of the search.

Explore Other Tools

12 suggested tools

View all tools