Text to group

Grouped result

How does it work?

This tool groups lines in text based on whether they match a specified pattern. It separates the input text into two groups:

  1. Lines that match the pattern (shown first)
  2. Lines that do not match the pattern (shown after the separator)

The filtering options include:

  • Case sensitivity: When enabled, matches must have the exact same case as the pattern
  • Regular expressions: When enabled, the pattern is treated as a regular expression for more powerful matching
  • Separator: Custom text to insert between the matching and non-matching groups

Example

Original text:

The quick brown fox jumps over the lazy dog.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
This line contains FOX in uppercase.
Another line with the word "fox" in lowercase.
1234 - This line has numbers.
Regular expressions are powerful.
The pattern /^T/ matches lines starting with T.
The end.

Example: Group by lines containing "fox" (case insensitive)

The quick brown fox jumps over the lazy dog.
This line contains FOX in uppercase.
Another line with the word "fox" in lowercase.

--- Non-matching lines ---

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
1234 - This line has numbers.
Regular expressions are powerful.
The pattern /^T/ matches lines starting with T.
The end.

Regular Expression Tips

When "Use regular expressions" is enabled, you can use patterns like:

  • ^ - Match the beginning of a line (e.g., ^The matches lines starting with "The")
  • $ - Match the end of a line (e.g., end\.$ matches lines ending with "end.")
  • \d - Match any digit (e.g., \d+ matches one or more digits)
  • \w - Match any word character (letters, numbers, underscore)
  • .* - Match any characters (e.g., a.*z matches lines with "a" followed by any characters and then "z")

This tool is useful for:

  • Organizing text into categories based on content
  • Separating relevant and irrelevant information
  • Analyzing patterns in logs or data files
  • Preparing data for further processing by category
  • Creating reports that group data by specific criteria

Tip:

This tool combines features of both "Grep" and "Inverted Grep" by keeping all lines but organizing them into matching and non-matching groups. You can customize the separator text to make the groups more distinct.

Related Tools

All Tools

See all available tools