Regex Tester
Live Matching
Highlights matches as you type the pattern.
Capture Groups
Shows numbered groups for each match.
Flag Toggles
Global, case-insensitive, multiline, dotAll.
Client-side
All processing in your browser. No data uploaded.
เกี่ยวกับ Regex Tester
Regular expressions (regex) are powerful patterns used to search, match, and manipulate text. They are an essential skill for software developers, data engineers, and system administrators — used everywhere from form validation and log parsing to URL routing and find-and-replace operations in code editors. This regex tester lets you write and debug JavaScript-flavoured regular expressions in real time. Type a pattern in the input field, add optional flags, then enter your test string in the textarea below. All matches are highlighted inline with distinct colours so you can see exactly what your pattern captures. A match detail panel below lists each match with its character index and any captured groups. Four flags are supported: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — makes . match newline characters). Errors in your pattern are displayed immediately with a clear message, helping you iterate quickly without guessing what went wrong.
วิธีใช้ Regex Tester
- Type your regular expression pattern between the two slash delimiters in the pattern field.
- Toggle the g, i, m, or s flag buttons to enable global matching, case-insensitivity, multiline mode, or dotAll mode.
- Paste or type your test string in the large textarea below the pattern field.
- Matches are highlighted in the text immediately — different colours distinguish multiple matches.
- Check the match list below the highlighted text to see each match, its position, and any capture groups.
- Refine your pattern until it matches exactly what you need, then copy it to use in your code.
คำถามที่พบบ่อย
Which regex flavour does this tool use?
This tool uses JavaScript's built-in RegExp engine (ECMAScript flavour). It supports most common features including lookaheads, lookbehinds, named capture groups, and Unicode — but not some PCRE-specific features like conditionals or atomic groups.
What does the g flag do?
The global (g) flag tells the engine to find all matches in the string instead of stopping after the first one. Without it, you'd only see the very first match.
How do I use capture groups?
Wrap part of your pattern in parentheses — for example (\d+) — to create a capture group. The matched text inside the group is shown separately in the Groups column of each match result.
Why does my pattern work here but not in my code?
Make sure you're applying the same flags in your code as you set here. Also note that in JavaScript string literals you need to double-escape backslashes (\\d instead of \d) when constructing a RegExp from a string.
What is the dotAll (s) flag?
By default, the dot (.) in a regex does not match newline characters. Enabling the s (dotAll) flag changes this so that . matches any character including \n and \r, which is useful for matching multi-line content.
เครื่องมือที่เกี่ยวข้อง
Top 10 Free Tools Every Developer Needs
Boost your productivity instantly. Get our exclusive cheatsheet featuring the most essential web utilities you didn't know you needed, delivered straight to your inbox.
We respect your inbox. Unsubscribe at any time.