Regex Tester API
Overview
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/regextesterExample
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)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))
}{
"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"
}
]
}
}
}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. The JSON response is shown in the Example section above; alternative formats below.
Other Response Formats
<?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
Only X-API-Key is required. Optional headers include Accept for response format negotiation (JSON, XML, or YAML), User-Agent, and X-Request-ID for request tracing. See all request headers →
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 accepts cross-origin requests from any origin, so it can be called directly from browser-based applications without a proxy. See CORS support →
Rate Limiting
Regex Tester requests are throttled per minute on the Free plan and unthrottled on paid plans. Exceeding the limit returns 429 Too Many Requests; rate-limit usage is reported in the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset response headers. See per-plan limits and best practices →
Error Codes
The Regex Tester API uses standard HTTP status codes — 200 on success, 400 for invalid parameters, 401 for missing or invalid keys, 403 for insufficient credits, 429 for rate-limit exhaustion, and 500/503 for server-side issues. Each error response includes an X-Request-ID header you can quote when contacting support. See full error handling guide →
SDKs for Regex Tester
Official Regex Tester packages on npm, PyPI, NuGet, and JitPack — plus a Postman collection and an OpenAPI spec. See the SDK guide →
No-Code Integrations
Regex Tester works with Zapier, Make, Pipedream, n8n, and Power Automate using the same API key. See 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.








