Regex Tester
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.
POST Endpoint
https://api.apiverve.com/v1/regextesterCode Examples
Here are examples of how to call this 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
This API requires authentication via API key. Include your API key in the request header:
X-API-Key: your_api_key_hereInteractive API Playground
Test this API directly in your browser with live requests and responses.
Parameters
The following parameters are available for this API endpoint:
| Parameter | Type | Required | Description | Default | Example |
|---|---|---|---|---|---|
| pattern | string | Yes | The regular expression pattern to test | - | \d{3}-\d{2}-\d{4} |
| text | string | Yes | The text to test the pattern against | - | My SSN is 123-45-6789 |
| flags | string | No | Regex flags: g (global), i (case insensitive), m (multiline), s (dotall), u (unicode), y (sticky) | - | gi |
| test_type | string | No | Operation type: 'test', 'match', 'search', 'replace', or 'split' (default: test) | test | match |
| replacement | string | No | Replacement text for 'replace' operation | - | [REDACTED] |
Response
The API returns responses in JSON, XML, YAML, Markdown, 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"
}
]
}
}
}<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()@:%_\+.~#?&//=]*)$</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)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{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>(?<name>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>(?<=abc)</symbol>
<description>Positive lookbehind</description>
</groups>
<groups>
<symbol>(?<!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>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| Field | Value |
| --- | --- |
| status | ok |
| error | |
| 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} |
| regex_info.flags.global | True |
| regex_info.flags.ignore_case | False |
| regex_info.flags.multiline | False |
| regex_info.flags.sticky | False |
| regex_info.flags.unicode | False |
| regex_info.flags.dot_all | False |
| regex_info.source | \d{3}-\d{2}-\d{4} |
| regex_info.last_index | 21 |
| regex_info.pattern_length | 17 |
| regex_info.complexity | Medium |
| test_results.operation | test |
| test_results.result | True |
| test_results.execution_time_ms | 0 |
| test_results.description | Returns true if pattern matches anywhere in text, false otherwise |
| performance.iterations | 192 |
| performance.total_time_ms | 0 |
| performance.average_time_ms | 0 |
| performance.performance_rating | Excellent |
| pattern_analysis.contains_anchors.start_anchor | False |
| pattern_analysis.contains_anchors.end_anchor | False |
| pattern_analysis.contains_anchors.word_boundary | False |
| pattern_analysis.contains_quantifiers.zero_or_more | False |
| pattern_analysis.contains_quantifiers.one_or_more | False |
| pattern_analysis.contains_quantifiers.zero_or_one | False |
| pattern_analysis.contains_quantifiers.specific_count | True |
| pattern_analysis.contains_quantifiers.range_count | False |
| pattern_analysis.contains_groups.capturing_groups | 0 |
| pattern_analysis.contains_groups.non_capturing_groups | 0 |
| pattern_analysis.contains_groups.named_groups | 0 |
| pattern_analysis.contains_character_classes.predefined_classes | True |
| pattern_analysis.contains_character_classes.custom_classes | False |
| pattern_analysis.contains_character_classes.negated_classes | False |
| pattern_analysis.contains_special_chars.wildcard | False |
| pattern_analysis.contains_special_chars.pipe | False |
| pattern_analysis.contains_special_chars.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"} |
| regex_guide.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"} |
| regex_guide.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)"} |
| regex_guide.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"} |
| regex_guide.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"} || status | error | pattern | text | flags | test_type | replacement | is_valid_regex | regex_info.pattern | regex_info.flags.global | regex_info.flags.ignore_case | regex_info.flags.multiline | regex_info.flags.sticky | regex_info.flags.unicode | regex_info.flags.dot_all | regex_info.source | regex_info.last_index | regex_info.pattern_length | regex_info.complexity | test_results.operation | test_results.result | test_results.execution_time_ms | test_results.description | performance.iterations | performance.total_time_ms | performance.average_time_ms | performance.performance_rating | pattern_analysis.contains_anchors.start_anchor | pattern_analysis.contains_anchors.end_anchor | pattern_analysis.contains_anchors.word_boundary | pattern_analysis.contains_quantifiers.zero_or_more | pattern_analysis.contains_quantifiers.one_or_more | pattern_analysis.contains_quantifiers.zero_or_one | pattern_analysis.contains_quantifiers.specific_count | pattern_analysis.contains_quantifiers.range_count | pattern_analysis.contains_groups.capturing_groups | pattern_analysis.contains_groups.non_capturing_groups | pattern_analysis.contains_groups.named_groups | pattern_analysis.contains_character_classes.predefined_classes | pattern_analysis.contains_character_classes.custom_classes | pattern_analysis.contains_character_classes.negated_classes | pattern_analysis.contains_special_chars.wildcard | pattern_analysis.contains_special_chars.pipe | pattern_analysis.contains_special_chars.escape_sequences | suggestions | common_patterns | regex_guide.basic_syntax | regex_guide.character_classes | regex_guide.quantifiers | regex_guide.groups | regex_guide.flags |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ok | \d{3}-\d{2}-\d{4} | My SSN is 123-45-6789 and my friend's is 987-65-4321 | g | test | True | \d{3}-\d{2}-\d{4} | True | False | False | False | False | False | \d{3}-\d{2}-\d{4} | 21 | 17 | Medium | test | True | 0 | Returns true if pattern matches anywhere in text, false otherwise | 192 | 0 | 0 | Excellent | False | False | False | False | False | False | True | False | 0 | 0 | 0 | True | False | False | False | False | 3 | Consider anchoring with ^ or $ if you need exact matches | {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} | {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} | {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} | {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)} | {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} | {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 | {...} |
Response Data Fields
When the request is successful, the data object contains the following fields:
| Field | Type | Sample Value |
|---|---|---|
| pattern | string | "\d{3}-\d{2}-\d{4}" |
| text | string | "My SSN is 123-45-6789 and my friend's is 987-65-4321" |
| flags | string | "g" |
| test_type | string | "test" |
| replacement | object | null |
| is_valid_regex | boolean | true |
| regex_info | object | {...} |
| â”” pattern | string | "\d{3}-\d{2}-\d{4}" |
| â”” flags | object | {...} |
| â”” global | boolean | true |
| â”” ignore_case | boolean | false |
| â”” multiline | boolean | false |
| â”” sticky | boolean | false |
| â”” unicode | boolean | false |
| â”” dot_all | boolean | false |
| â”” source | string | "\d{3}-\d{2}-\d{4}" |
| â”” last_index | number | 21 |
| â”” pattern_length | number | 17 |
| â”” complexity | string | "Medium" |
| test_results | object | {...} |
Headers
Required and optional headers for API requests:
| Header Name | Required | Example Value | Description |
|---|---|---|---|
| X-API-Key | Yes | your_api_key_here | Your APIVerve API key. Found in your dashboard under API Keys. |
| Accept | No | application/json | Specify response format: application/json (default), application/xml, or application/yaml |
| User-Agent | No | MyApp/1.0 | Identifies your application for analytics and debugging purposes |
| X-Request-ID | No | req_123456789 | Custom request identifier for tracking and debugging requests |
| Cache-Control | No | no-cache | Control caching behavior for the request and response |
GraphQL AccessALPHA
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.
Not all APIs support GraphQL. Check the API schema or test in the GraphQL Explorer to confirm availability for this specific endpoint.
Token Cost: Each API called in your GraphQL query consumes its standard token 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
All APIVerve APIs support Cross-Origin Resource Sharing (CORS) with wildcard configuration, allowing you to call the API 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 make direct API calls from JavaScript running in the browser without encountering CORS errors. No additional configuration needed.
Rate Limiting
APIVerve implements rate limiting to ensure fair usage and maintain service quality across all users. Rate limits vary by subscription plan and are applied per API key.
| Plan | Rate Limit | Description |
|---|---|---|
| Free | 5 requests/min | Hard rate limit enforced - exceeding will return 429 errors |
| Starter | No Limit | Production ready - no rate limiting or throttling |
| Pro | No Limit | Production ready - no rate limiting or throttling |
| Mega | No Limit | Production ready - no rate limiting or throttling |
Rate Limit Headers
When rate limits apply, each API 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, the API 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:
- Monitor the rate limit headers to track your usage (Free plan only)
- Implement caching where appropriate to reduce API calls
- Upgrade to Pro or Mega for guaranteed no-throttle performance
Note: Rate limits are separate from token consumption. You may have tokens remaining but still hit rate limits on Free tier.
Client Libraries
To get started with minimal code, most of our APIs are available through client libraries and clients:
Error Codes
The 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 tokens | Check token 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 |
Need help? Contact support with your X-Request-ID for assistance.
Frequently Asked Questions
How do I get an API key?
What are tokens and how do they work?
Tokens are your API usage currency. Each successful API call consumes tokens based on the API's complexity. Most APIs cost 1 token per call, while more complex APIs may cost 2-5 tokens. Failed requests and errors don't consume tokens. Check the API details above to see the token cost for this specific API.
Can I use this API in production?
The free plan is for testing and development only. For production use, 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 this API from a browser?
What happens if I exceed my token limit?
When you reach your monthly token limit, 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.
Was this page helpful?
Help us improve our documentation



