Regex Tester
Enter a pattern and the matches are highlighted in place in your text, with each capture group broken out separately. A list of matches on its own does not tell you where in the text they landed, so you get both.
2 matches
Reach us at hong@example.com or kim@test.co.kr.
- 12 hong@example.com1=hong 2=example.com
- 32 kim@test.co1=kim 2=test.co
These are JavaScript regular expressions. Python and Java differ in subtle ways, so check again before porting.
How to enter the pattern
Type only what goes between the slashes: \d+, not /\d+/g. A pattern doubled up for a string literal in code, like \\d, needs only one backslash here — doubled, it matches a literal backslash. Matching reruns as you type, and a syntax error shows the browser engine's own message.
The five flags
i ignores case, m makes ^ and $ match at each line. s lets . match a newline, and u treats four-byte characters such as emoji as one character. g runs as if always on, regardless of the toggle — listing every match requires it.
Groups and the match list
Each match shows its start position, the matched text, and its groups. Numbered groups appear as 1=…; a named group like (?<year>…) appears twice, once by number and once by name. An optional group that did not participate shows —. Highlighting covers up to 500 matches; the list shows the first 50. A pattern that matches the empty string, such as a*, matches once at every position and produces as many results as there are characters — require at least one with a+.
Frequently asked questions
Can a pattern freeze my browser?
A pattern with nested repetition such as (a+)+b, given a long enough subject, makes backtracking explode and the tab stops responding. The 2-second limit here is checked only between one match and the next, so a pattern that produces many matches is stopped there, but one that explodes inside a single match cannot be interrupted. Rewrite nested repetition before you run it — that is the only real defence.
Will my pattern behave the same in Python?
This is the JavaScript engine. Lookbehind support and named-group syntax differ in small ways between languages, so check on the other side when you port a pattern.
Which flavour is it?
JavaScript regular expressions. Some things differ from Python or Java — named group syntax and lookbehind support among them. If the pattern is destined for another language, check it there too.
Only the first match is highlighted.
This screen always finds every match: the global flag (g) is added regardless of the toggle, so if only one is highlighted, only one actually matches. If the pattern seems to stop mid-word, check word boundaries (\b) and the characters around it. Add i to ignore case.
What regex should I use to validate an email address?
There is no complete one, and you would not want it. Encoding all of RFC 5322 runs to thousands of characters and still differs from what mail servers accept. Something like ^[^\s@]+@[^\s@]+\.[^\s@]+$ checks for one @ and a domain with a dot; confirm the rest by sending a message.
How do I match only Korean or Japanese text?
[가-힣]+ covers composed Korean syllables; lone jamo such as ㄱ fall outside it, so add [ㄱ-ㅎㅏ-ㅣ]. For Japanese, [ぁ-んァ-ン一-龯]+ covers kana and common kanji. With the u flag, \p{Script=Hangul} or \p{Script=Han} does it in one step.
Does anything I paste get sent to a server?
No. Everything runs inside your browser and nothing is uploaded or stored. That is why you can use it on things you would not normally paste into a web page, like an internal config file or a production query. It also works with your network disconnected.