Regex Tester API
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.
The Regex Tester 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 Regex Tester, you need an API key. You can get one by creating a free account and visiting your dashboard.
POST Endpoint
https://api.apiverve.com/v1/regextesterCode Examples
Here are examples of how to call the Regex Tester API in different programming languages:
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"
}'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);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)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
$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);
?>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))
}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))using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "your_api_key_here");
var jsonContent = @"{
""pattern"": ""\\d{3}-\\d{2}-\\d{4}"",
""text"": ""My SSN is 123-45-6789 and my friend's is 987-65-4321"",
""flags"": ""g""
}";
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.apiverve.com/v1/regextester", content);
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}Authentication
The Regex Tester API requires authentication via API key. Include your API key in the request header:
X-API-Key: your_api_key_hereInteractive API Playground
Test the Regex Tester API directly in your browser with live requests and responses.
Parameters
The following parameters are available for the Regex Tester API:
Test Regex Pattern
| Parameter | Type | Required | Description | Default | Example |
|---|---|---|---|---|---|
pattern | string | required | The regular expression pattern to test | - | |
text | string | required | The text to test the pattern against | - | |
flags | string | optional | Regex flags: g (global), i (case insensitive), m (multiline), s (dotall), u (unicode), y (sticky) | - | |
test_type | string | optional | Operation type Supported values: testmatchsearchreplacesplit | ||
replacement | string | optional | Replacement text for 'replace' operation | - |
Response
The Regex Tester API returns responses in JSON, XML, YAML, and CSV formats:
Example Responses
{
"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 version="1.0" encoding="UTF-8"?>
<response>
<status>ok</status>
<error xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<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 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<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>
<suggestion>Consider anchoring with ^ or $ if you need exact matches</suggestion>
</suggestions>
<common_patterns>
<common_pattern>
<name>Email Address</name>
<pattern>^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,}$</pattern>
<description>Matches valid email addresses</description>
<example>[email protected]</example>
</common_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<name>URL</name>
<pattern>^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$</pattern>
<description>Matches HTTP and HTTPS URLs</description>
<example>https://www.example.com</example>
</common_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<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_pattern>
<common_pattern>
<name>Strong Password</name>
<pattern>^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$</pattern>
<description>At least 8 chars with uppercase, lowercase, digit, and special char</description>
<example>MyP@ssw0rd</example>
</common_pattern>
</common_patterns>
<regex_guide>
<basic_syntax>
<item>
<symbol>.</symbol>
<description>Matches any single character except newline</description>
</item>
<item>
<symbol>*</symbol>
<description>Matches 0 or more of the preceding character</description>
</item>
<item>
<symbol>+</symbol>
<description>Matches 1 or more of the preceding character</description>
</item>
<item>
<symbol>?</symbol>
<description>Matches 0 or 1 of the preceding character</description>
</item>
<item>
<symbol>^</symbol>
<description>Matches start of string</description>
</item>
<item>
<symbol>$</symbol>
<description>Matches end of string</description>
</item>
<item>
<symbol>|</symbol>
<description>OR operator</description>
</item>
<item>
<symbol>\</symbol>
<description>Escape character</description>
</item>
</basic_syntax>
<character_classes>
<character_classe>
<symbol>[abc]</symbol>
<description>Matches any character in the set</description>
</character_classe>
<character_classe>
<symbol>[^abc]</symbol>
<description>Matches any character NOT in the set</description>
</character_classe>
<character_classe>
<symbol>[a-z]</symbol>
<description>Matches any lowercase letter</description>
</character_classe>
<character_classe>
<symbol>[A-Z]</symbol>
<description>Matches any uppercase letter</description>
</character_classe>
<character_classe>
<symbol>[0-9]</symbol>
<description>Matches any digit</description>
</character_classe>
<character_classe>
<symbol>\d</symbol>
<description>Matches any digit (equivalent to [0-9])</description>
</character_classe>
<character_classe>
<symbol>\w</symbol>
<description>Matches any word character [a-zA-Z0-9_]</description>
</character_classe>
<character_classe>
<symbol>\s</symbol>
<description>Matches any whitespace character</description>
</character_classe>
</character_classes>
<quantifiers>
<quantifier>
<symbol>{n}</symbol>
<description>Matches exactly n times</description>
</quantifier>
<quantifier>
<symbol>{n,}</symbol>
<description>Matches n or more times</description>
</quantifier>
<quantifier>
<symbol>{n,m}</symbol>
<description>Matches between n and m times</description>
</quantifier>
<quantifier>
<symbol>*?</symbol>
<description>Non-greedy: matches 0 or more (lazy)</description>
</quantifier>
<quantifier>
<symbol>+?</symbol>
<description>Non-greedy: matches 1 or more (lazy)</description>
</quantifier>
<quantifier>
<symbol>??</symbol>
<description>Non-greedy: matches 0 or 1 (lazy)</description>
</quantifier>
</quantifiers>
<groups>
<group>
<symbol>(abc)</symbol>
<description>Capturing group</description>
</group>
<group>
<symbol>(?:abc)</symbol>
<description>Non-capturing group</description>
</group>
<group>
<symbol>(?<name>abc)</symbol>
<description>Named capturing group</description>
</group>
<group>
<symbol>(?=abc)</symbol>
<description>Positive lookahead</description>
</group>
<group>
<symbol>(?!abc)</symbol>
<description>Negative lookahead</description>
</group>
<group>
<symbol>(?<=abc)</symbol>
<description>Positive lookbehind</description>
</group>
<group>
<symbol>(?<!abc)</symbol>
<description>Negative lookbehind</description>
</group>
</groups>
<flags>
<flag>
<flag>g</flag>
<description>Global - find all matches</description>
</flag>
<flag>
<flag>i</flag>
<description>Case insensitive</description>
</flag>
<flag>
<flag>m</flag>
<description>Multiline - ^ and $ match line breaks</description>
</flag>
<flag>
<flag>s</flag>
<description>Dot matches newline characters</description>
</flag>
<flag>
<flag>u</flag>
<description>Unicode mode</description>
</flag>
<flag>
<flag>y</flag>
<description>Sticky - matches from lastIndex position</description>
</flag>
</flags>
</regex_guide>
</data>
</response>
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
| key | value |
|---|---|
| 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:
| Field | Type | Description | Example |
|---|---|---|---|
status | string | Indicates whether the request was successful ("ok") or failed ("error") | ok |
error | string | null | Contains error message if status is "error", otherwise null | null |
data | object | null | Contains the API response data if successful, otherwise null | {...} |
Learn more about response formats →
Response Data Fields
When the request is successful, the data object contains the following fields:
| Field | Type | Sample Value | Description |
|---|---|---|---|
pattern | string | - | |
text | string | - | |
flags | string | - | |
test_type | string | - | |
replacement | object | - | |
is_valid_regex | boolean | - | |
regex_info | object | - | |
â”” pattern | string | - | |
â”” flags | object | - | |
â”” global | boolean | - | |
â”” ignore_case | boolean | - | |
â”” multiline | boolean | - | |
â”” sticky | boolean | - | |
â”” unicode | boolean | - | |
â”” dot_all | boolean | - | |
â”” source | string | - | |
â”” last_index | number | - | |
â”” pattern_length | number | - | |
â”” complexity | string | - | |
test_results | object | - |
Headers
Required and optional headers for Regex Tester API requests:
| Header Name | Required | Example Value | Description |
|---|---|---|---|
X-API-Key | required | your_api_key_here | Your APIVerve API key. Found in your dashboard under API Keys. |
Accept | optional | application/json | Specify response format: application/json (default), application/xml, or application/yaml |
User-Agent | optional | MyApp/1.0 | Identifies your application for analytics and debugging purposes |
X-Request-ID | optional | req_123456789 | Custom request identifier for tracking and debugging requests |
Cache-Control | optional | no-cache | Control caching behavior for the request and response |
GraphQL AccessALPHA
Access Regex Tester through GraphQL to combine it with other API calls in a single request. Query only the regex tester data you need with precise field selection, and orchestrate complex data fetching workflows.
Credit Cost: Each API called in your GraphQL query consumes its standard credit cost.
POST https://api.apiverve.com/v1/graphqlquery {
regextester(
input: {
pattern: "\d{3}-\d{2}-\d{4}"
text: "My SSN is 123-45-6789 and my friend's is 987-65-4321"
flags: "g"
}
) {
pattern
text
flags
test_type
replacement
is_valid_regex
regex_info {
pattern
flags {
global
ignore_case
multiline
sticky
unicode
dot_all
}
source
last_index
pattern_length
complexity
}
test_results {
operation
result
execution_time_ms
description
}
performance {
iterations
total_time_ms
average_time_ms
performance_rating
}
pattern_analysis {
contains_anchors {
start_anchor
end_anchor
word_boundary
}
contains_quantifiers {
zero_or_more
one_or_more
zero_or_one
specific_count
range_count
}
contains_groups {
capturing_groups
non_capturing_groups
named_groups
}
contains_character_classes {
predefined_classes
custom_classes
negated_classes
}
contains_special_chars {
wildcard
pipe
escape_sequences
}
}
suggestions
common_patterns
regex_guide {
basic_syntax
character_classes
quantifiers
groups
flags
}
}
}Note: Authentication is handled via the x-api-key header in your GraphQL request, not as a query parameter.
CORS Support
The Regex Tester API supports Cross-Origin Resource Sharing (CORS) with wildcard configuration, allowing you to call Regex Tester directly from browser-based applications without proxy servers.
| CORS Header | Value | Description |
|---|---|---|
Access-Control-Allow-Origin | * | Accepts requests from any origin |
Access-Control-Allow-Methods | * | Accepts any HTTP method |
Access-Control-Allow-Headers | * | Accepts any request headers |
Browser Usage: You can call Regex Tester directly from JavaScript running in the browser without encountering CORS errors. No proxy server or additional configuration needed.
Rate Limiting
Regex Tester API requests are subject to rate limiting based on your subscription plan. These limits ensure fair usage and maintain service quality for all Regex Tester users.
| Plan | Rate Limit | Description |
|---|---|---|
| Free | 5 requests/min | Hard rate limit enforced - exceeding will return 429 errors |
| Starter | No Limit | Production ready - standard traffic priority |
| Pro | No Limit | Production ready - preferred traffic priority |
| Mega | No Limit | Production ready - highest traffic priority |
Learn more about rate limiting →
Rate Limit Headers
When rate limits apply, each Regex Tester response includes headers to help you track your usage:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum number of requests allowed per time window |
X-RateLimit-Remaining | Number of requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit window resets |
Handling Rate Limits
Free Plan: When you exceed your rate limit, Regex Tester returns a 429 Too Many Requests status code. Your application should implement appropriate backoff logic to handle this gracefully.
Paid Plans: No rate limiting or throttling applied. All paid plans (Starter, Pro, Mega) are production-ready.
Best Practices for Regex Tester:
- Monitor the rate limit headers to track your Regex Tester usage (Free plan only)
- Cache regex tester responses where appropriate to reduce API calls
- Upgrade to Pro or Mega for guaranteed no-throttle Regex Tester performance
Note: Regex Tester rate limits are separate from credit consumption. You may have credits remaining but still hit rate limits when using Regex Tester on Free tier.
Error Codes
The Regex Tester API uses standard HTTP status codes to indicate success or failure:
| Code | Message | Description | Solution |
|---|---|---|---|
200 | OK | Request successful, data returned | No action needed - request was successful |
400 | Bad Request | Invalid request parameters or malformed request | Check required parameters and ensure values match expected formats |
401 | Unauthorized | Missing or invalid API key | Include x-api-key header with valid API key from dashboard |
403 | Forbidden | API key lacks permission or insufficient credits | Check credit balance in dashboard or upgrade plan |
429 | Too Many Requests | Rate limit exceeded (Free: 5 req/min) | Implement request throttling or upgrade to paid plan |
500 | Internal Server Error | Server error occurred | Retry request after a few seconds, contact support if persists |
503 | Service Unavailable | API temporarily unavailable | Wait and retry, check status page for maintenance updates |
Learn more about error handling →
Need help? Contact support with your X-Request-ID for assistance.
Integrate Regex Tester with SDKs
Get started quickly with official Regex Tester SDKs for your preferred language. Each library handles authentication, request formatting, and error handling automatically.
Available for Node.js, Python, C#/.NET, and Android/Java. All SDKs are open source and regularly updated.
Integrate Regex Tester with No-Code API Tools
Connect the Regex Tester API to your favorite automation platform without writing code. Build workflows that leverage regex tester data across thousands of apps.





All platforms use your same API key to access Regex Tester. Visit our integrations hub for step-by-step setup guides.
Frequently Asked Questions
How do I get an API key for Regex Tester?
How many credits does Regex Tester cost?
Each successful Regex Tester API call consumes credits based on plan tier. Check the pricing section above for the exact credit cost. Failed requests and errors don't consume credits, so you only pay for successful regex tester lookups.
Can I use Regex Tester in production?
The free plan is for testing and development only. For production use of Regex Tester, upgrade to a paid plan (Starter, Pro, or Mega) which includes commercial use rights, no attribution requirements, and guaranteed uptime SLAs. All paid plans are production-ready.
Can I use Regex Tester from a browser?
What happens if I exceed my Regex Tester credit limit?
When you reach your monthly credit limit, Regex Tester API requests will return an error until you upgrade your plan or wait for the next billing cycle. You'll receive notifications at 80% and 95% usage to give you time to upgrade if needed.



