Regex tester

Test a regular expression against text and see every match with its position and groups.

Input

The regular expression (Python syntax).
The text to search.
Letters that switch options on: i (ignore case), m (^ and $ match at each line), s (dot matches line breaks), x (allow spaces and comments).

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/regex-test \
  -H 'Content-Type: application/json' \
  -d '{"input":{"pattern":"(?P<year>\\d{4})-(\\d{2})","text":"From 2024-01 to 2025-12"}}'
import json, urllib.request

body = {'input': {'pattern': '(?P<year>\\d{4})-(\\d{2})', 'text': 'From 2024-01 to 2025-12'}}
request = urllib.request.Request("https://setget.net/v1/tools/regex-test", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/regex-test", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"pattern":"(?P<year>\\d{4})-(\\d{2})","text":"From 2024-01 to 2025-12"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "regex-test",
  "input": {
    "pattern": "(?P<year>\\d{4})-(\\d{2})",
    "text": "From 2024-01 to 2025-12"
  }
}
{
  "input": {
    "pattern": "(?P<year>\\d{4})-(\\d{2})",
    "text": "From 2024-01 to 2025-12"
  }
}

Endpoint: POST /v1/tools/regex-test. Over MCP: run_tool with slug: "regex-test". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
pattern string yes The regular expression (Python syntax).
text string yes The text to search.
flags string no Letters that switch options on: i (ignore case), m (^ and $ match at each line), s (dot matches line breaks), x (allow spaces and comments). Default: "".

Examples

Input
{
  "pattern": "(?P<year>\\d{4})-(\\d{2})",
  "text": "From 2024-01 to 2025-12"
}
Result
{
  "matched": true,
  "count": 2,
  "truncated": false,
  "matches": [
    {
      "match": "2024-01",
      "start": 5,
      "end": 12,
      "groups": [
        "2024",
        "01"
      ],
      "named": {
        "year": "2024"
      }
    },
    {
      "match": "2025-12",
      "start": 16,
      "end": 23,
      "groups": [
        "2025",
        "12"
      ],
      "named": {
        "year": "2025"
      }
    }
  ]
}

Ignoring case

Input
{
  "pattern": "^hello",
  "text": "Hello there",
  "flags": "i"
}
Result
{
  "matched": true,
  "count": 1,
  "truncated": false,
  "matches": [
    {
      "match": "Hello",
      "start": 0,
      "end": 5,
      "groups": [],
      "named": {}
    }
  ]
}

Questions

Which regex syntax is this?
Python's. It is close to PCRE and JavaScript, with named groups written (?P<name>...).
How are positions counted?
"start" and "end" count characters from 0. "end" is the position just after the match.
Why is a group null?
That group is optional and took no part in the match.