Regex TesterRegex Tester

Token Usage:1 per call

Regex Tester is a comprehensive tool for testing and validating regular expressions. It supports multiple operations (test, match, search, replace, split) with detailed performance analysis and pattern suggestions.

This API provides reliable and fast access to regex tester data through a simple REST interface. Built for developers who need consistent, high-quality results with minimal setup time.

To use this API, you need an API key. You can get one by creating a free account and visiting your dashboard.

View API in Directory

Endpoint

POST Request
POST https://api.apiverve.com/v1/regextester

Code Examples

Here are examples of how to call this API in different programming languages:

cURL Request
curl -X POST \
  "https://api.apiverve.com/v1/regextester" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "pattern": "\\d{3}-\\d{2}-\\d{4}",
  "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
  "flags": "g"
}'
JavaScript (Fetch API)
const response = await fetch('https://api.apiverve.com/v1/regextester', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your_api_key_here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "pattern": "\\d{3}-\\d{2}-\\d{4}",
    "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
    "flags": "g"
})
});

const data = await response.json();
console.log(data);
Python (Requests)
import requests

headers = {
    'X-API-Key': 'your_api_key_here',
    'Content-Type': 'application/json'
}

payload = {
    "pattern": "\\d{3}-\\d{2}-\\d{4}",
    "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
    "flags": "g"
}

response = requests.post('https://api.apiverve.com/v1/regextester', headers=headers, json=payload)

data = response.json()
print(data)
Node.js (Native HTTPS)
const https = require('https');
const url = require('url');

const options = {
  method: 'POST',
  headers: {
    'X-API-Key': 'your_api_key_here',
    'Content-Type': 'application/json'
  }
};

const postData = JSON.stringify({
  "pattern": "\\d{3}-\\d{2}-\\d{4}",
  "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
  "flags": "g"
});

const req = https.request('https://api.apiverve.com/v1/regextester', options, (res) => {
  let data = '';
  res.on('data', (chunk) => data += chunk);
  res.on('end', () => console.log(JSON.parse(data)));
});

req.write(postData);
req.end();
PHP (cURL)
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.apiverve.com/v1/regextester');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-Key: your_api_key_here',
    'Content-Type: application/json'
]);

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode({
    'pattern': '\\d{3}-\\d{2}-\\d{4}',
    'text': 'My SSN is 123-45-6789 and my friend's is 987-65-4321',
    'flags': 'g'
}));

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
print_r($data);

?>
Go (net/http)
package main

import (
    "fmt"
    "io"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    payload := map[string]interface{}{
        "pattern": "\d{3}-\d{2}-\d{4}",
        "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
        "flags": "g"
    }

    jsonPayload, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", "https://api.apiverve.com/v1/regextester", bytes.NewBuffer(jsonPayload))

    req.Header.Set("X-API-Key", "your_api_key_here")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Ruby (Net::HTTP)
require 'net/http'
require 'json'

uri = URI('https://api.apiverve.com/v1/regextester')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

payload = {
  "pattern": "\\d{3}-\\d{2}-\\d{4}",
  "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
  "flags": "g"
}

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'your_api_key_here'
request['Content-Type'] = 'application/json'

request.body = payload.to_json

response = http.request(request)
puts JSON.pretty_generate(JSON.parse(response.body))

Authentication

This API requires authentication via API key. Include your API key in the request header:

Required Header
X-API-Key: your_api_key_here

GraphQL AccessBETA

Most APIVerve APIs support GraphQL queries, allowing you to combine multiple API calls into a single request and retrieve only the data you need. This powerful feature enables you to orchestrate complex data fetching with precise field selection.

This API does not currently support GraphQL as it requires a POST request. GraphQL support for POST APIs is coming soon.

Parameters

The following parameters are available for this API endpoint:

ParameterTypeRequiredLocationDescriptionExample
patternstringYesbodyThe regular expression pattern to test\d{3}-\d{2}-\d{4}
textstringYesbodyThe text to test the pattern againstMy SSN is 123-45-6789 and my friend's is 987-65-4321
flagsstringNobodyRegex flags: g (global), i (case insensitive), m (multiline), s (dotall), u (unicode), y (sticky)g
test_typestringNobodyOperation type: 'test', 'match', 'search', 'replace', or 'split' (default: test)test
replacementstringNobodyReplacement text for 'replace' operation-

Response

The API returns responses in JSON, XML, and YAML formats:

Example Responses

JSON Response
200 OK
{
  "status": "ok",
  "error": null,
  "data": {
    "pattern": "\\d{3}-\\d{2}-\\d{4}",
    "text": "My SSN is 123-45-6789 and my friend's is 987-65-4321",
    "flags": "g",
    "test_type": "test",
    "replacement": null,
    "is_valid_regex": true,
    "regex_info": {
      "pattern": "\\d{3}-\\d{2}-\\d{4}",
      "flags": {
        "global": true,
        "ignore_case": false,
        "multiline": false,
        "sticky": false,
        "unicode": false,
        "dot_all": false
      },
      "source": "\\d{3}-\\d{2}-\\d{4}",
      "last_index": 21,
      "pattern_length": 17,
      "complexity": "Medium"
    },
    "test_results": {
      "operation": "test",
      "result": true,
      "execution_time_ms": 0,
      "description": "Returns true if pattern matches anywhere in text, false otherwise"
    },
    "performance": {
      "iterations": 192,
      "total_time_ms": 0,
      "average_time_ms": 0,
      "performance_rating": "Excellent"
    },
    "pattern_analysis": {
      "contains_anchors": {
        "start_anchor": false,
        "end_anchor": false,
        "word_boundary": false
      },
      "contains_quantifiers": {
        "zero_or_more": false,
        "one_or_more": false,
        "zero_or_one": false,
        "specific_count": true,
        "range_count": false
      },
      "contains_groups": {
        "capturing_groups": 0,
        "non_capturing_groups": 0,
        "named_groups": 0
      },
      "contains_character_classes": {
        "predefined_classes": true,
        "custom_classes": false,
        "negated_classes": false
      },
      "contains_special_chars": {
        "wildcard": false,
        "pipe": false,
        "escape_sequences": 3
      }
    },
    "suggestions": [
      "Consider anchoring with ^ or $ if you need exact matches"
    ],
    "common_patterns": [
      {
        "name": "Email Address",
        "pattern": "^[\\w\\.-]+@[\\w\\.-]+\\.[a-zA-Z]{2,}$",
        "description": "Matches valid email addresses",
        "example": "[email protected]"
      },
      {
        "name": "Phone Number (US)",
        "pattern": "^\\(?(\\d{3})\\)?[-.\\s]?(\\d{3})[-.\\s]?(\\d{4})$",
        "description": "Matches US phone numbers in various formats",
        "example": "(123) 456-7890"
      },
      {
        "name": "URL",
        "pattern": "^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$",
        "description": "Matches HTTP and HTTPS URLs",
        "example": "https://www.example.com"
      },
      {
        "name": "IP Address (IPv4)",
        "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",
        "description": "Matches valid IPv4 addresses",
        "example": "192.168.1.1"
      },
      {
        "name": "Credit Card Number",
        "pattern": "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$",
        "description": "Matches major credit card formats",
        "example": "4532123456789012"
      },
      {
        "name": "Social Security Number",
        "pattern": "^\\d{3}-?\\d{2}-?\\d{4}$",
        "description": "Matches SSN with or without dashes",
        "example": "123-45-6789"
      },
      {
        "name": "Date (MM/DD/YYYY)",
        "pattern": "^(0[1-9]|1[0-2])\\/(0[1-9]|[12][0-9]|3[01])\\/(19|20)\\d{2}$",
        "description": "Matches MM/DD/YYYY date format",
        "example": "12/31/2023"
      },
      {
        "name": "Time (24-hour)",
        "pattern": "^([01]?[0-9]|2[0-3]):[0-5][0-9]$",
        "description": "Matches 24-hour time format",
        "example": "14:30"
      },
      {
        "name": "Hexadecimal Color",
        "pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
        "description": "Matches hex color codes",
        "example": "#FF5733"
      },
      {
        "name": "Strong Password",
        "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$",
        "description": "At least 8 chars with uppercase, lowercase, digit, and special char",
        "example": "MyP@ssw0rd"
      }
    ],
    "regex_guide": {
      "basic_syntax": [
        {
          "symbol": ".",
          "description": "Matches any single character except newline"
        },
        {
          "symbol": "*",
          "description": "Matches 0 or more of the preceding character"
        },
        {
          "symbol": "+",
          "description": "Matches 1 or more of the preceding character"
        },
        {
          "symbol": "?",
          "description": "Matches 0 or 1 of the preceding character"
        },
        {
          "symbol": "^",
          "description": "Matches start of string"
        },
        {
          "symbol": "$",
          "description": "Matches end of string"
        },
        {
          "symbol": "|",
          "description": "OR operator"
        },
        {
          "symbol": "\\",
          "description": "Escape character"
        }
      ],
      "character_classes": [
        {
          "symbol": "[abc]",
          "description": "Matches any character in the set"
        },
        {
          "symbol": "[^abc]",
          "description": "Matches any character NOT in the set"
        },
        {
          "symbol": "[a-z]",
          "description": "Matches any lowercase letter"
        },
        {
          "symbol": "[A-Z]",
          "description": "Matches any uppercase letter"
        },
        {
          "symbol": "[0-9]",
          "description": "Matches any digit"
        },
        {
          "symbol": "\\d",
          "description": "Matches any digit (equivalent to [0-9])"
        },
        {
          "symbol": "\\w",
          "description": "Matches any word character [a-zA-Z0-9_]"
        },
        {
          "symbol": "\\s",
          "description": "Matches any whitespace character"
        }
      ],
      "quantifiers": [
        {
          "symbol": "{n}",
          "description": "Matches exactly n times"
        },
        {
          "symbol": "{n,}",
          "description": "Matches n or more times"
        },
        {
          "symbol": "{n,m}",
          "description": "Matches between n and m times"
        },
        {
          "symbol": "*?",
          "description": "Non-greedy: matches 0 or more (lazy)"
        },
        {
          "symbol": "+?",
          "description": "Non-greedy: matches 1 or more (lazy)"
        },
        {
          "symbol": "??",
          "description": "Non-greedy: matches 0 or 1 (lazy)"
        }
      ],
      "groups": [
        {
          "symbol": "(abc)",
          "description": "Capturing group"
        },
        {
          "symbol": "(?:abc)",
          "description": "Non-capturing group"
        },
        {
          "symbol": "(?<name>abc)",
          "description": "Named capturing group"
        },
        {
          "symbol": "(?=abc)",
          "description": "Positive lookahead"
        },
        {
          "symbol": "(?!abc)",
          "description": "Negative lookahead"
        },
        {
          "symbol": "(?<=abc)",
          "description": "Positive lookbehind"
        },
        {
          "symbol": "(?<!abc)",
          "description": "Negative lookbehind"
        }
      ],
      "flags": [
        {
          "flag": "g",
          "description": "Global - find all matches"
        },
        {
          "flag": "i",
          "description": "Case insensitive"
        },
        {
          "flag": "m",
          "description": "Multiline - ^ and $ match line breaks"
        },
        {
          "flag": "s",
          "description": "Dot matches newline characters"
        },
        {
          "flag": "u",
          "description": "Unicode mode"
        },
        {
          "flag": "y",
          "description": "Sticky - matches from lastIndex position"
        }
      ]
    }
  }
}
XML Response
200 OK
<Root>
  <status>ok</status>
  <error />
  <data>
    <pattern>\d{3}-\d{2}-\d{4}</pattern>
    <text>My SSN is 123-45-6789 and my friend's is 987-65-4321</text>
    <flags>g</flags>
    <test_type>test</test_type>
    <replacement />
    <is_valid_regex>true</is_valid_regex>
    <regex_info>
      <pattern>\d{3}-\d{2}-\d{4}</pattern>
      <flags>
        <global>true</global>
        <ignore_case>false</ignore_case>
        <multiline>false</multiline>
        <sticky>false</sticky>
        <unicode>false</unicode>
        <dot_all>false</dot_all>
      </flags>
      <source>\d{3}-\d{2}-\d{4}</source>
      <last_index>21</last_index>
      <pattern_length>17</pattern_length>
      <complexity>Medium</complexity>
    </regex_info>
    <test_results>
      <operation>test</operation>
      <result>true</result>
      <execution_time_ms>0</execution_time_ms>
      <description>Returns true if pattern matches anywhere in text, false otherwise</description>
    </test_results>
    <performance>
      <iterations>192</iterations>
      <total_time_ms>0</total_time_ms>
      <average_time_ms>0</average_time_ms>
      <performance_rating>Excellent</performance_rating>
    </performance>
    <pattern_analysis>
      <contains_anchors>
        <start_anchor>false</start_anchor>
        <end_anchor>false</end_anchor>
        <word_boundary>false</word_boundary>
      </contains_anchors>
      <contains_quantifiers>
        <zero_or_more>false</zero_or_more>
        <one_or_more>false</one_or_more>
        <zero_or_one>false</zero_or_one>
        <specific_count>true</specific_count>
        <range_count>false</range_count>
      </contains_quantifiers>
      <contains_groups>
        <capturing_groups>0</capturing_groups>
        <non_capturing_groups>0</non_capturing_groups>
        <named_groups>0</named_groups>
      </contains_groups>
      <contains_character_classes>
        <predefined_classes>true</predefined_classes>
        <custom_classes>false</custom_classes>
        <negated_classes>false</negated_classes>
      </contains_character_classes>
      <contains_special_chars>
        <wildcard>false</wildcard>
        <pipe>false</pipe>
        <escape_sequences>3</escape_sequences>
      </contains_special_chars>
    </pattern_analysis>
    <suggestions>Consider anchoring with ^ or $ if you need exact matches</suggestions>
    <common_patterns>
      <name>Email Address</name>
      <pattern>^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,}$</pattern>
      <description>Matches valid email addresses</description>
      <example>[email protected]</example>
    </common_patterns>
    <common_patterns>
      <name>Phone Number (US)</name>
      <pattern>^\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})$</pattern>
      <description>Matches US phone numbers in various formats</description>
      <example>(123) 456-7890</example>
    </common_patterns>
    <common_patterns>
      <name>URL</name>
      <pattern>^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&amp;//=]*)$</pattern>
      <description>Matches HTTP and HTTPS URLs</description>
      <example>https://www.example.com</example>
    </common_patterns>
    <common_patterns>
      <name>IP Address (IPv4)</name>
      <pattern>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</pattern>
      <description>Matches valid IPv4 addresses</description>
      <example>192.168.1.1</example>
    </common_patterns>
    <common_patterns>
      <name>Credit Card Number</name>
      <pattern>^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$</pattern>
      <description>Matches major credit card formats</description>
      <example>4532123456789012</example>
    </common_patterns>
    <common_patterns>
      <name>Social Security Number</name>
      <pattern>^\d{3}-?\d{2}-?\d{4}$</pattern>
      <description>Matches SSN with or without dashes</description>
      <example>123-45-6789</example>
    </common_patterns>
    <common_patterns>
      <name>Date (MM/DD/YYYY)</name>
      <pattern>^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d{2}$</pattern>
      <description>Matches MM/DD/YYYY date format</description>
      <example>12/31/2023</example>
    </common_patterns>
    <common_patterns>
      <name>Time (24-hour)</name>
      <pattern>^([01]?[0-9]|2[0-3]):[0-5][0-9]$</pattern>
      <description>Matches 24-hour time format</description>
      <example>14:30</example>
    </common_patterns>
    <common_patterns>
      <name>Hexadecimal Color</name>
      <pattern>^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$</pattern>
      <description>Matches hex color codes</description>
      <example>#FF5733</example>
    </common_patterns>
    <common_patterns>
      <name>Strong Password</name>
      <pattern>^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&amp;])[A-Za-z\d@$!%*?&amp;]{8,}$</pattern>
      <description>At least 8 chars with uppercase, lowercase, digit, and special char</description>
      <example>MyP@ssw0rd</example>
    </common_patterns>
    <regex_guide>
      <basic_syntax>
        <symbol>.</symbol>
        <description>Matches any single character except newline</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>*</symbol>
        <description>Matches 0 or more of the preceding character</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>+</symbol>
        <description>Matches 1 or more of the preceding character</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>?</symbol>
        <description>Matches 0 or 1 of the preceding character</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>^</symbol>
        <description>Matches start of string</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>$</symbol>
        <description>Matches end of string</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>|</symbol>
        <description>OR operator</description>
      </basic_syntax>
      <basic_syntax>
        <symbol>\</symbol>
        <description>Escape character</description>
      </basic_syntax>
      <character_classes>
        <symbol>[abc]</symbol>
        <description>Matches any character in the set</description>
      </character_classes>
      <character_classes>
        <symbol>[^abc]</symbol>
        <description>Matches any character NOT in the set</description>
      </character_classes>
      <character_classes>
        <symbol>[a-z]</symbol>
        <description>Matches any lowercase letter</description>
      </character_classes>
      <character_classes>
        <symbol>[A-Z]</symbol>
        <description>Matches any uppercase letter</description>
      </character_classes>
      <character_classes>
        <symbol>[0-9]</symbol>
        <description>Matches any digit</description>
      </character_classes>
      <character_classes>
        <symbol>\d</symbol>
        <description>Matches any digit (equivalent to [0-9])</description>
      </character_classes>
      <character_classes>
        <symbol>\w</symbol>
        <description>Matches any word character [a-zA-Z0-9_]</description>
      </character_classes>
      <character_classes>
        <symbol>\s</symbol>
        <description>Matches any whitespace character</description>
      </character_classes>
      <quantifiers>
        <symbol>{n}</symbol>
        <description>Matches exactly n times</description>
      </quantifiers>
      <quantifiers>
        <symbol>{n,}</symbol>
        <description>Matches n or more times</description>
      </quantifiers>
      <quantifiers>
        <symbol>{n,m}</symbol>
        <description>Matches between n and m times</description>
      </quantifiers>
      <quantifiers>
        <symbol>*?</symbol>
        <description>Non-greedy: matches 0 or more (lazy)</description>
      </quantifiers>
      <quantifiers>
        <symbol>+?</symbol>
        <description>Non-greedy: matches 1 or more (lazy)</description>
      </quantifiers>
      <quantifiers>
        <symbol>??</symbol>
        <description>Non-greedy: matches 0 or 1 (lazy)</description>
      </quantifiers>
      <groups>
        <symbol>(abc)</symbol>
        <description>Capturing group</description>
      </groups>
      <groups>
        <symbol>(?:abc)</symbol>
        <description>Non-capturing group</description>
      </groups>
      <groups>
        <symbol>(?&lt;name&gt;abc)</symbol>
        <description>Named capturing group</description>
      </groups>
      <groups>
        <symbol>(?=abc)</symbol>
        <description>Positive lookahead</description>
      </groups>
      <groups>
        <symbol>(?!abc)</symbol>
        <description>Negative lookahead</description>
      </groups>
      <groups>
        <symbol>(?&lt;=abc)</symbol>
        <description>Positive lookbehind</description>
      </groups>
      <groups>
        <symbol>(?&lt;!abc)</symbol>
        <description>Negative lookbehind</description>
      </groups>
      <flags>
        <flag>g</flag>
        <description>Global - find all matches</description>
      </flags>
      <flags>
        <flag>i</flag>
        <description>Case insensitive</description>
      </flags>
      <flags>
        <flag>m</flag>
        <description>Multiline - ^ and $ match line breaks</description>
      </flags>
      <flags>
        <flag>s</flag>
        <description>Dot matches newline characters</description>
      </flags>
      <flags>
        <flag>u</flag>
        <description>Unicode mode</description>
      </flags>
      <flags>
        <flag>y</flag>
        <description>Sticky - matches from lastIndex position</description>
      </flags>
    </regex_guide>
  </data>
</Root>
YAML Response
200 OK
status: ok
error: 
data:
  pattern: \d{3}-\d{2}-\d{4}
  text: My SSN is 123-45-6789 and my friend's is 987-65-4321
  flags: g
  test_type: test
  replacement: 
  is_valid_regex: true
  regex_info:
    pattern: \d{3}-\d{2}-\d{4}
    flags:
      global: true
      ignore_case: false
      multiline: false
      sticky: false
      unicode: false
      dot_all: false
    source: \d{3}-\d{2}-\d{4}
    last_index: 21
    pattern_length: 17
    complexity: Medium
  test_results:
    operation: test
    result: true
    execution_time_ms: 0
    description: Returns true if pattern matches anywhere in text, false otherwise
  performance:
    iterations: 192
    total_time_ms: 0
    average_time_ms: 0
    performance_rating: Excellent
  pattern_analysis:
    contains_anchors:
      start_anchor: false
      end_anchor: false
      word_boundary: false
    contains_quantifiers:
      zero_or_more: false
      one_or_more: false
      zero_or_one: false
      specific_count: true
      range_count: false
    contains_groups:
      capturing_groups: 0
      non_capturing_groups: 0
      named_groups: 0
    contains_character_classes:
      predefined_classes: true
      custom_classes: false
      negated_classes: false
    contains_special_chars:
      wildcard: false
      pipe: false
      escape_sequences: 3
  suggestions:
  - Consider anchoring with ^ or $ if you need exact matches
  common_patterns:
  - name: Email Address
    pattern: ^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,}$
    description: Matches valid email addresses
    example: [email protected]
  - name: Phone Number (US)
    pattern: ^\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})$
    description: Matches US phone numbers in various formats
    example: (123) 456-7890
  - name: URL
    pattern: ^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$
    description: Matches HTTP and HTTPS URLs
    example: https://www.example.com
  - name: IP Address (IPv4)
    pattern: ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
    description: Matches valid IPv4 addresses
    example: 192.168.1.1
  - name: Credit Card Number
    pattern: ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$
    description: Matches major credit card formats
    example: 4532123456789012
  - name: Social Security Number
    pattern: ^\d{3}-?\d{2}-?\d{4}$
    description: Matches SSN with or without dashes
    example: 123-45-6789
  - name: Date (MM/DD/YYYY)
    pattern: ^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d{2}$
    description: Matches MM/DD/YYYY date format
    example: 12/31/2023
  - name: Time (24-hour)
    pattern: ^([01]?[0-9]|2[0-3]):[0-5][0-9]$
    description: Matches 24-hour time format
    example: 14:30
  - name: Hexadecimal Color
    pattern: ^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
    description: Matches hex color codes
    example: '#FF5733'
  - name: Strong Password
    pattern: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
    description: At least 8 chars with uppercase, lowercase, digit, and special char
    example: MyP@ssw0rd
  regex_guide:
    basic_syntax:
    - symbol: .
      description: Matches any single character except newline
    - symbol: '*'
      description: Matches 0 or more of the preceding character
    - symbol: +
      description: Matches 1 or more of the preceding character
    - symbol: '?'
      description: Matches 0 or 1 of the preceding character
    - symbol: ^
      description: Matches start of string
    - symbol: $
      description: Matches end of string
    - symbol: '|'
      description: OR operator
    - symbol: \
      description: Escape character
    character_classes:
    - symbol: '[abc]'
      description: Matches any character in the set
    - symbol: '[^abc]'
      description: Matches any character NOT in the set
    - symbol: '[a-z]'
      description: Matches any lowercase letter
    - symbol: '[A-Z]'
      description: Matches any uppercase letter
    - symbol: '[0-9]'
      description: Matches any digit
    - symbol: \d
      description: Matches any digit (equivalent to [0-9])
    - symbol: \w
      description: Matches any word character [a-zA-Z0-9_]
    - symbol: \s
      description: Matches any whitespace character
    quantifiers:
    - symbol: '{n}'
      description: Matches exactly n times
    - symbol: '{n,}'
      description: Matches n or more times
    - symbol: '{n,m}'
      description: Matches between n and m times
    - symbol: '*?'
      description: 'Non-greedy: matches 0 or more (lazy)'
    - symbol: +?
      description: 'Non-greedy: matches 1 or more (lazy)'
    - symbol: ??
      description: 'Non-greedy: matches 0 or 1 (lazy)'
    groups:
    - symbol: (abc)
      description: Capturing group
    - symbol: (?:abc)
      description: Non-capturing group
    - symbol: (?<name>abc)
      description: Named capturing group
    - symbol: (?=abc)
      description: Positive lookahead
    - symbol: (?!abc)
      description: Negative lookahead
    - symbol: (?<=abc)
      description: Positive lookbehind
    - symbol: (?<!abc)
      description: Negative lookbehind
    flags:
    - flag: g
      description: Global - find all matches
    - flag: i
      description: Case insensitive
    - flag: m
      description: Multiline - ^ and $ match line breaks
    - flag: s
      description: Dot matches newline characters
    - flag: u
      description: Unicode mode
    - flag: y
      description: Sticky - matches from lastIndex position

Response Structure

All API responses follow a consistent structure with the following fields:

FieldTypeDescriptionExample
statusstringIndicates whether the request was successful ("ok") or failed ("error")ok
errorstring | nullContains error message if status is "error", otherwise nullnull
dataobject | nullContains the API response data if successful, otherwise null{...}

Response Data Fields

When the request is successful, the data object contains the following fields:

FieldTypeSample Value
patternstring"\d{3}-\d{2}-\d{4}"
textstring"My SSN is 123-45-6789 and my friend's is 987-65-4321"
flagsstring"g"
test_typestring"test"
replacementobjectnull
is_valid_regexbooleantrue
regex_infoobject{...}
regex_info.patternstring"\d{3}-\d{2}-\d{4}"
regex_info.flagsobject{...}
regex_info.flags.globalbooleantrue
regex_info.flags.ignore_casebooleanfalse
regex_info.flags.multilinebooleanfalse
regex_info.flags.stickybooleanfalse
regex_info.flags.unicodebooleanfalse
regex_info.flags.dot_allbooleanfalse
regex_info.sourcestring"\d{3}-\d{2}-\d{4}"
regex_info.last_indexnumber21
regex_info.pattern_lengthnumber17
regex_info.complexitystring"Medium"
test_resultsobject{...}

Headers

Required and optional headers for API requests:

Header NameRequiredExample ValueDescription
X-API-KeyYesyour_api_key_hereYour APIVerve API key. Found in your dashboard under API Keys.
AcceptNoapplication/jsonSpecify response format: application/json (default), application/xml, or application/yaml
User-AgentNoMyApp/1.0Identifies your application for analytics and debugging purposes
X-Request-IDNoreq_123456789Custom request identifier for tracking and debugging requests
Cache-ControlNono-cacheControl caching behavior for the request and response

Client Libraries

To get started with minimal code, most of our APIs are available through client libraries and clients:

Run in PostmanNPMPyPINuGetSwagger

Error Codes

The API uses standard HTTP status codes to indicate success or failure:

Status CodeMessageDescription
200OKRequest successful, data returned
400Bad RequestInvalid request parameters or malformed request
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key does not have permission for this endpoint
429Too Many RequestsRate limit exceeded, please slow down requests
500Internal Server ErrorServer error, please try again later

What's Next?

Continue your journey with these recommended resources

Was this page helpful?

Help us improve our documentation