πŸ› οΈToolsShed

RegEx Tester

Test and debug regular expressions with live match highlighting.

//g

Regex Tester lets you write and test regular expressions against a block of text in real time. As you type your pattern, the tool highlights every match in the test string and displays captured groups, so you can see exactly how your expression behaves before using it in production code.

Enter your regular expression in the pattern field, choose any flags (global, case-insensitive, multiline, dotAll), and paste the text to search in the input area. Matches are highlighted inline and a match list below shows each captured group with its index position.

Regular expressions are used for form validation, text parsing, log analysis, search-and-replace operations, and much more. This tool supports the standard JavaScript regex engine, making it compatible with Node.js, browsers, and many other environments.

Frequently Asked Questions

Code Implementation

import re

text = "Order 123 and order 456 were placed on 2024-01-15."

# Find all numbers
numbers = re.findall(r'\d+', text)
print(numbers)  # ['123', '456', '2024', '01', '15']

# Match a date pattern
pattern = re.compile(r'(\d{4})-(\d{2})-(\d{2})')
match = pattern.search(text)
if match:
    print(match.group(0))  # 2024-01-15
    print(match.group(1))  # 2024 (year)

# Replace with a function
result = re.sub(r'\d+', lambda m: f'[{m.group()}]', text)
print(result)  # Order [123] and order [456] were placed on [2024]-[01]-[15].

# Case-insensitive search
emails = re.findall(r'[\w.+-]+@[\w-]+\.[\w.]+', text, re.IGNORECASE)

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.