How to Test and Debug Regular Expressions Online
Regular expressions (regex) are powerful pattern-matching tools used in programming, but they're notoriously difficult to write and debug. A single typo can make a regex fail or match the wrong text. This guide shows you how to test and debug regular expressions using fixie.tools — a free online regex tester with real-time matching, explanations, and support for JavaScript, Python, and other regex flavors.
Step 1: Open the Regex Tester
Go to fixie.tools/regex in your web browser. The tool works entirely in your browser with no server uploads or data storage. No account or signup is required.
Step 2: Enter Your Regular Expression
In the pattern field at the top, type or paste your regular expression. Don't include the surrounding slashes or delimiters — just the pattern itself. For example, enter \d{3}-\d{4} to match phone numbers like 555-1234. The tool provides syntax highlighting to help you identify different pattern components.
Step 3: Add Test Text
In the test text area, enter or paste the text you want to test your regex against. This could be sample data, log files, or any text where you want to find or validate patterns. As you type, the tool highlights all matches in real-time so you can immediately see what your regex captures.
Step 4: Select Regex Flavor and Flags
Choose your target programming language or regex flavor (JavaScript, Python, PCRE, etc.) from the dropdown, as different languages have slightly different regex syntax and features. Enable flags like case-insensitive matching (i), multiline mode (m), or global matching (g) using the checkboxes. The tool shows how these flags affect your matches.
Step 5: Review Matches and Explanation
The tool displays all matches with capture groups highlighted in different colors. Below your pattern, you'll see a plain-English explanation of what your regex does, breaking down each component. Use this to verify your regex matches what you intended and debug any issues. The match count and execution time help you optimize complex patterns.