Online Regex Tester & Debugger
Use this tool to test your regular expressions in real-time. Enter your regex pattern and the text to search, and see the matches instantly highlighted below.
Introduction to Regular Expressions
Regular Expressions (Regex) are patterns used to match character combinations in strings. They are widely used for searching, replacing, and validating text.
Using the Regex Tester
- Enter Regex Pattern: In the "Regex Pattern" field, input your desired regular expression.
- Enter Text: In the "Text to Search" area, input the text where you want to apply the regex.
- Test Regex: Click the "Test Regex" button to see the matches.
- Generate Sample Regex: Click the "Generate Sample Regex" button to load predefined regex patterns and texts for practice.
Regex Syntax Basics
.- Matches any single character except newline.*- Matches 0 or more occurrences of the preceding element.+- Matches 1 or more occurrences of the preceding element.?- Makes the preceding element optional.\d- Matches any digit (equivalent to [0-9]).\w- Matches any word character (alphanumeric & underscore).\s- Matches any whitespace character (spaces, tabs, line breaks).^- Asserts position at the start of a line.$- Asserts position at the end of a line.
Examples
Try generating sample regex patterns to see how different patterns work with various texts.