Categories

Multi-Pattern Matcher

Match multiple regex patterns against text in one operation

Pattern Format (one per line):

Label|Pattern|Flags

Examples:

  • Email|\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b|gi
  • Phone|\b\d{3}-\d{3}-\d{4}\b|g
  • URL|https?://[^\s]+|gi

Flags (optional):

  • g - Global (find all matches)
  • i - Case insensitive
  • m - Multiline
  • s - Dot matches newline
  • u - Unicode

Notes:

  • Flags are optional (defaults to 'g')
  • Patterns with named groups will extract those values
  • Results are sorted by match count (descending)

One pattern per line: Label|Pattern|Flags (flags optional)

Key Facts

Category
Development
Input Types
textarea, checkbox, number
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

The Multi-Pattern Matcher enables you to define and execute multiple regular expression patterns against a single text input in one operation. It supports labeled patterns with optional flags, streamlining batch text processing and data extraction tasks.

When to Use

  • When extracting multiple data types like emails, phone numbers, or URLs from large text documents.
  • For analyzing logs or reports to find specific patterns across different categories simultaneously.
  • When validating text input against several regex rules in a single run to save time and reduce errors.

How It Works

  • Enter or paste the text to search in the Text Input field.
  • Define patterns in the Patterns field, one per line, using the format: Label|Pattern|Flags.
  • Adjust optional settings such as case sensitivity, showing empty patterns, or limiting matches per pattern.
  • Run the tool to receive a JSON result with matches grouped by pattern label and sorted by frequency.

Use Cases

Extracting contact information like emails and phone numbers from customer feedback or survey responses.
Scanning server logs for error codes, IP addresses, and timestamps in a single operation for efficient monitoring.
Validating user-submitted text against multiple content policies, such as checking for profanity, links, or specific formats.

Examples

1. Extracting Contact Details from Text

Data Analyst
Background
You have a large text file containing customer inquiries and need to pull out all email addresses and phone numbers for follow-up.
Problem
Manually searching for each type of contact information is time-consuming and prone to missing entries.
How to Use
Paste the text into the Text Input field. In Patterns, enter: Email|\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b|gi and Phone|\b\d{3}-\d{3}-\d{4}\b|g
Outcome
The tool returns a JSON object with all found emails and phone numbers, labeled and sorted by frequency, enabling quick export or analysis.

2. Log File Analysis for Security Monitoring

Security Engineer
Background
You need to monitor web server logs for suspicious activities, including failed login attempts and access from blacklisted IPs.
Problem
Logs are extensive, and manually checking for multiple patterns across different categories is inefficient and delays incident response.
How to Use
Paste the log text into the Text Input field. Define patterns such as FailedLogin|Failed password for .* from \d+\.\d+\.\d+\.\d+|gi and IP|\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b|g in the Patterns field.
Outcome
A structured JSON list of all matches is generated, helping to quickly identify and investigate security incidents by pattern label.

Try with Samples

text, regex

Related Hubs

FAQ

What is the pattern format for defining rules?

Each pattern should be on a new line in the format: Label|Pattern|Flags. Flags are optional and include g (global), i (case insensitive), m (multiline), s (dot matches newline), and u (Unicode).

Can I use named groups in my regex patterns?

Yes, patterns with named groups will extract those values in the results, making it easier to identify specific data.

What happens if a pattern has no matches in the text?

By default, patterns with no matches are not shown in the results. You can enable 'Show Empty Patterns' to include them for completeness.

Is there a limit to how many matches are returned per pattern?

You can set a maximum number of matches per pattern using the 'Max Matches Per Pattern' option, which defaults to 50 to prevent overwhelming output.

How are the results organized in the output?

Results are returned as JSON, sorted by match count in descending order, so patterns with the most matches appear first for quick analysis.

API Documentation

Request Endpoint

POST /en/api/tools/multi-pattern-matcher

Request Parameters

Parameter Name Type Required Description
textInput textarea Yes -
patterns textarea Yes One pattern per line: Label|Pattern|Flags (flags optional)
caseSensitive checkbox No -
showEmptyPatterns checkbox No -
maxMatchesPerPattern number No -

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-multi-pattern-matcher": {
      "name": "multi-pattern-matcher",
      "description": "Match multiple regex patterns against text in one operation",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=multi-pattern-matcher",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]