x402

Regex Explain (x402)

Explain a regular expression in plain English with token-by-token breakdown. Optionally test against sample strings.

get/x402/v2/regex-explain

Request

  • Base URL: https://api.strale.io
  • URL: https://api.strale.io/x402/v2/regex-explain
  • Auth: none required

Query parameters

regexstring required
unknown

Response

Success

plain_englishstring
capture_groupsinteger

Example response

{
  "breakdown": [
    {
      "token": "^",
      "explanation": "Anchors the match to the start of the string"
    },
    {
      "token": "[a-zA-Z0-9._%+-]+",
      "explanation": "Matches one or more characters that are letters (upper/lowercase), digits, or the special characters . _ % + -"
    },
    {
      "token": "@",
      "explanation": "Matches the literal @ symbol"
    },
    {
      "token": "[a-zA-Z0-9.-]+",
      "explanation": "Matches one or more letters, digits, dots, or hyphens for the domain name"
    },
    {
      "token": "\\.",
      "explanation": "Matches a literal dot (escaped with backslash)"
    },
    {
      "token": "[a-zA-Z]{2,}",
      "explanation": "Matches 2 or more letters only for the top-level domain (TLD)"
    },
    {
      "token": "$",
      "explanation": "Anchors the match to the end of the string"
    }
  ],
  "plain_english": "This regex matches standard email addresses with a local part containing alphanumeric characters and special symbols, followed by an @ symbol, a domain name, and a top-level domain of at least 2 letters.",
  "capture_groups": 0,
  "common_matches": [
    "user@example.com",
    "john.doe+tag@company.co.uk",
    "test_email.123@domain-name.org",
    "a@b.co"
  ],
  "flags_detected": {
    "g": false,
    "i": false,
    "m": false
  },
  "original_regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
  "common_non_matches": [
    "invalid.email@.com",
    "user@domain",
    "user name@example.com",
    "@example.com",
    "user@.com",
    "user@domain.c"
  ]
}

Changes

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