developer

Use this when you need the true matches of a JavaScript regular expression rather than predicting regex behavior yourself, which is easy to get wrong.

Use this when you need the true matches of a JavaScript regular expression rather than predicting regex behavior yourself, which is easy to get wrong. Deterministic: same input, same output. Returns every match with its index, length, matched text, positional capture groups (null for a group that didn't participate), and named groups (an object, or null when the pattern has none). Without the g flag only the first match is returned; with g all matches are collected, capped at 10,000 with truncated=true. Inputs are length-bounded (pattern 2,000 chars, text 50,000 chars) as a ReDoS guard. Example: pattern (?<y>\d{4})-(?<m>\d{2}) over "2024-01" with flag g -> matchCount 1, match "2024-01", groups ["2024","01"], named {y:"2024",m:"01"}.

post/v1/test_regex

Request

  • Base URL: https://api.clean.tools
  • URL: https://api.clean.tools/v1/test_regex
  • Auth: none declared

Request body

patternstring required

Regular expression source (no delimiters).

textstring required

String to search.

flagsstring

Any of g i m s u v y.

Response

Structured tool result.

toolstring

Changes

No recorded changes to this operation across all 1 revision of this API.