본문으로 건너뛰기
Tools Star Hub

정규식 테스터

예시 텍스트에 정규 표현식을 적용해 각 일치 항목과 위치, 그룹을 확인합니다.

도구를 불러오는 중…

이 도구는 브라우저에서 실행됩니다. 입력값, 파일, 생성된 값은 이 기기에 남습니다. 즐겨찾기와 최근 사용한 도구를 이용하더라도 로컬 저장소에는 도구 이름만 저장되며, 비밀번호나 문서, QR 내용은 절대 저장되지 않습니다. 자세한 내용은 개인정보처리방침을 확인하세요.

이 도구의 자세한 안내(사용법, 예시, 자주 묻는 질문)는 현재 영어로만 제공됩니다.

What this tool does

Type a regular expression, choose flags, and paste the text you want to test. The page lists whether anything matched, how many matches it found, the matched text, where each match starts, and any capture groups.

How to use

  1. Enter the pattern without surrounding slashes.
  2. Turn on the flags you need. g finds every match. i ignores case. m changes ^ and $. s lets a dot match a line break. u turns on Unicode mode.
  3. Paste the test text.
  4. Press Test expression. An invalid pattern shows the browser’s syntax message.

Examples

  • Find amounts

    Pattern \d+, flag g, text “Order 14 and order 3”. You get two matches, 14 at the first digit and 3 at the later digit.

  • Capture a name

    Pattern Name: (\w+) on “Name: Sara” shows the full match and group 1 as Sara.

Main features

  • Match count, matched text, and the character index where each match starts.
  • Numbered groups and named groups when the pattern has them.
  • A stop after 50 matches so a huge result does not fill the page.

How it works

The page builds a JavaScript RegExp and runs it on the text you pasted. It does not eval the pattern as a script. A dot matches one character. * means zero or more, + means one or more, and ? means optional. Brackets match one character from a set. Parentheses capture a group. A bar means or. \d is a digit, \s is whitespace, and \w is a word character. Without g, only the first match is listed.

Tips

  • Test a small sample before you use the same pattern in code.
  • If the pattern can match an empty string, the tester still moves forward so it does not loop forever. You will see an empty match when that happens.

Limitations

This uses the browser’s JavaScript regular expressions, which differ from some other engines. A pattern longer than 300 characters is rejected. A very slow pattern can still stall the tab. The page does not sandbox the match in a separate process. It will not run other JavaScript you type in the pattern box.

See the disclaimer for what these tools do not cover.

FAQ

Why do I only see one match?
Turn on the g flag. Without it, the result stops after the first match.
Does this execute code from the pattern?
No. The pattern is passed to the RegExp constructor. It is not evaluated as a program.
Is my input sent to a server?
No. The pattern and the sample text are tested in this tab. They are not uploaded.
What does the g flag do in a regex?
The g (global) flag finds every match instead of stopping at the first one. Without it, only the first match is shown.
What is a capture group?
Parentheses in a pattern create a capture group, which saves the part of the match inside them. (\d{4})-(\d{2}) captures the year and the month separately.