콘텐츠로 이동
모든 도구

Regex Lab

사용 가능

실시간 매치, 단위 테스트, 선별된 라이브러리, 호환성 분석 및 안전한 로컬 실행으로 정규식을 작성하고 테스트하고 디버깅하고 재사용합니다.

로컬에서 실행됩니다. 테스트 데이터는 이 브라우저를 벗어나지 않습니다.
//gm
JavaScript / ECMAScript·브라우저 네이티브 실행
매치 하이라이트 미리보기
INFO server ready
WARN retrying request
ERROR upstream timeout
DEBUG hidden diagnostics

Regex 라이브러리

설명, 예제, 바로 실행할 수 있는 테스트가 포함된 선별된 레시피를 검색하고 전체 레시피를 작업공간에 불러옵니다.

Practical email address

validation · javascript

Matches a pragmatic email shape for UI validation without pretending to implement the full RFC grammar.

/^[^\s@]+@[^\s@]+\.[^\s@]+$/i
emailformsvalidation

UUID v4

validation · javascript

Matches canonical UUID version 4 strings with the correct version and variant nibble.

/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
uuididentifierapi

ISO date shape

dates · javascript

Matches YYYY-MM-DD text shape. Calendar validity such as leap years still belongs to date parsing.

/\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\b/g
dateisoyyyy-mm-dd

HEX color

validation · javascript

Matches three, four, six or eight digit CSS hexadecimal color values.

/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i
csscolorhexfrontend

Semantic version core

extraction · javascript

Extracts major, minor and patch numbers with optional prerelease and build metadata.

/\b(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<pre>[0-9A-Za-z.-]+))?(?:\+(?<build>[0-9A-Za-z.-]+))?\b/g
semverversionrelease

HTTP(S) URL

web · javascript

Finds HTTP and HTTPS URLs in prose. Use URL parsing for authoritative validation.

/https?:\/\/[^\s<>"]+/gi
urlhttphttpsweb

Key/value log fields

logs · javascript

Extracts simple key=value pairs and exposes key and value as named captures.

/(?<key>[A-Za-z_][\w.-]*)=(?<value>"[^"]*"|[^\s]+)/g
logskey-valueobservability

Log level

logs · javascript

Finds common application log levels as standalone words.

/\b(?:TRACE|DEBUG|INFO|WARN|ERROR|FATAL)\b/gi
logsleveldebugobservability

URL slug

validation · javascript

Matches lowercase URL slugs made of alphanumeric segments separated by single hyphens.

/^[a-z0-9]+(?:-[a-z0-9]+)*$/
slugurlrouting

IPv4 address

validation · javascript

Matches IPv4 octets from 0 to 255 without accepting over-range values.

/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/
ipnetworkipv4

JWT compact shape

extraction · javascript

Finds strings shaped like a compact three-part JWT/JWS. It does not validate signatures or claims.

/\b[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\b/g
jwttokensecurity

Double quoted string

text · javascript

Extracts double-quoted strings while allowing escaped characters inside them.

/"(?:\\.|[^"\\])*"/g
stringquotesparser

빠른 참조

자주 쓰는 앵커, 문자 클래스, 그룹, lookaround, 수량자 및 연산자를 검색합니다.

모든 token

80개 표시 · 전체 80개 token

\n

Newline character

패턴
\r

Carriage return character

패턴
\t

Tab character

패턴
\0

Null character

패턴
\f

Form feed character

패턴
\v

Vertical tab character

패턴
.

Any character except line terminators unless dotAll is enabled

패턴
a|b

Alternation — match either expression

패턴
\d

Any digit character

패턴
\D

Any non-digit character

패턴
\w

Any word character

패턴
\W

Any non-word character

패턴
\s

Any whitespace character

패턴
\S

Any non-whitespace character

패턴
[abc]

One character from the set

패턴
[^abc]

One character not present in the set

패턴
[a-z]

One character inside a range

패턴
[a-zA-Z]

One character from multiple ranges

패턴
[[:alnum:]]

POSIX letters and digits class

패턴pcre2
[[:alpha:]]

POSIX letters class

패턴pcre2
[[:digit:]]

POSIX decimal digits class

패턴pcre2
[[:space:]]

POSIX whitespace class

패턴pcre2
[[:word:]]

POSIX word-character class

패턴pcre2
^

Start of input, or start of line in multiline mode

패턴
$

End of input, or end of line in multiline mode

패턴
\A

Absolute start of string

패턴pcre2
\Z

End of string, or before its final line terminator

패턴pcre2
\z

Absolute end of string

패턴pcre2
\b

Word boundary

패턴
\B

Non-word boundary

패턴
\G

Start of the current match attempt

패턴pcre2
a?

Zero or one occurrence

패턴
a*

Zero or more occurrences

패턴
a+

One or more occurrences

패턴
a{3}

Exactly three occurrences

패턴
a{3,}

Three or more occurrences

패턴
a{3,6}

Between three and six occurrences

패턴
a*?

Lazy quantifier — consume as little as possible

패턴
a*+

Possessive quantifier — do not backtrack

패턴pcre2
(...)

Capturing group

패턴
(?:...)

Non-capturing group

패턴
(?<name>...)

Named capturing group

패턴javascript
(?P<name>...)

Python-style named capturing group

패턴python
(?>...)

Atomic non-capturing group

패턴pcre2
(?#...)

Inline comment group

패턴pcre2
(?=...)

Positive lookahead assertion

패턴
(?!...)

Negative lookahead assertion

패턴
(?<=...)

Positive lookbehind assertion

패턴
(?<!...)

Negative lookbehind assertion

패턴
\1

Match text previously captured by group 1

패턴
\k<name>

Match text captured by a named group

패턴javascript
\k{name}

PCRE2 named backreference

패턴pcre2
\g{-1}

PCRE2 relative numeric backreference

패턴pcre2
g

Global matching

플래그javascript
m

Multiline anchors

플래그
i

Case-insensitive matching

플래그
s

Dot matches line terminators

플래그
u

Unicode-aware matching

플래그javascript
y

Sticky matching from the current lastIndex

플래그javascript
x

Ignore pattern whitespace and allow comments

플래그pcre2
U

Invert default greediness

플래그pcre2
$&

Insert the complete match

치환javascript
$1

Insert capture group 1

치환
$<name>

Insert a named capture group

치환javascript
$$

Insert a literal dollar sign

치환javascript
$`

Insert content before the match

치환javascript
$'

Insert content after the match

치환javascript
${1}

PCRE2 replacement capture group

치환pcre2
\p{Letter}

Match a Unicode property or script category

패턴
\P{Letter}

Negated Unicode property or script category

패턴
\X

Extended Unicode grapheme sequence

패턴pcre2
\R

Unicode newline sequence

패턴pcre2
\x20

Character by hexadecimal value

패턴
\u{1F600}

Unicode code point escape

패턴javascript
\Q...\E

Treat enclosed text as literals

패턴pcre2
\K

Reset the reported start of the current match

패턴pcre2
(*ACCEPT)

PCRE2 control verb — immediately accept the current match

패턴pcre2
(*FAIL)

PCRE2 control verb — force the current match path to fail

패턴pcre2
(*SKIP)

PCRE2 control verb — move the next match attempt forward

패턴pcre2
(*UTF)

Enable UTF mode in PCRE2

패턴pcre2

격리된 실행

JavaScript 정규식은 전용 Web Worker에서 엄격한 타임아웃과 함께 실행되어 문제가 있는 패턴이 Devary UI를 멈추지 않도록 합니다.

이식성을 고려한 설계

대상 flavor를 선택해 이식성 문제를 확인하고 하나의 엔진이 모든 런타임과 같다고 가장하지 않은 채 코드를 생성합니다.

개인 작업공간

패턴, 예제, 테스트 및 가져온 handoff는 브라우저 메모리에만 남으며 Devary 백엔드로 전송되지 않습니다.

실전 가이드

실제 예제로 정규식을 테스트하고 디버깅하기

Regex Lab은 브라우저에서 JavaScript 정규식 엔진으로 예제 텍스트를 검사합니다. 이름 있는 캡처 그룹을 해석하고 테스트를 반복 실행하며 다른 언어로 옮길 때의 한계를 확인하는 방법을 알아보세요.

패턴에서 검증된 결과까지

  1. 엔진과 모드 선택

    실제 정규식 실행에는 JavaScript / ECMAScript를 선택하세요. Match 모드에서 일치 결과를 확인할 수 있습니다. 다른 대상 엔진은 호환성 분석만 제공하며 직접 실행하지 않습니다.

  2. 패턴과 텍스트 입력

    양쪽 슬래시 없이 패턴을 입력하고 전체 일치에 쓰는 g, 줄별 앵커에 쓰는 m 같은 플래그를 선택하세요. 대표적인 예제 텍스트를 입력한 뒤 강조 표시와 캡처 그룹을 확인합니다.

  3. 테스트로 변경 사항 검증

    Unit Tests에 일치해야 하는 사례와 일치하지 않아야 하는 사례를 추가합니다. 패턴을 변경할 때마다 다시 실행하여 예상한 동작을 유지하는지 확인하세요.

재현 가능한 예제

애플리케이션 로그에서 수준과 메시지 추출

Match 모드에서 로그 두 줄을 붙여 넣고 gm을 사용합니다. 이름 있는 그룹 level과 message가 각 필드를 추출합니다. 표시된 결과는 Regex Lab의 실제 JavaScript 엔진으로 계산됩니다.

패턴

(?<level>INFO|WARN|ERROR)\s+(?<message>.+)

플래그

gm

테스트 텍스트 또는 사례

INFO server ready
ERROR upstream timeout

예상 결과

INFO: server ready
ERROR: upstream timeout

16진수 색상 값 검사

Unit Tests에서 각 줄을 별도 사례로 추가하세요. 첫 번째는 일치, 두 번째는 불일치여야 합니다. 앵커는 #을 요구하며 i 플래그는 대문자를 허용합니다. ✓는 일치, ✗는 불일치입니다.

패턴

^#[0-9a-f]{6}$

플래그

i

테스트 텍스트 또는 사례

#0ea5e9
0ea5e9

예상 결과

#0ea5e9 → ✓
0ea5e9 → ✗

중요한 제한 사항

JavaScript만 실제 실행

일치 검사는 시간 제한이 있는 브라우저 Worker에서 ECMAScript RegExp로 실행됩니다. 다른 언어에서는 같은 패턴도 다르게 동작할 수 있습니다.

호환성 분석은 참고용

PCRE2, Python, Java, .NET, Go, Rust는 정적 분석과 코드 예제만 제공하며 해당 엔진에서 실행하지 않습니다. 대상 실행 환경에서 반드시 검증하세요.

비용이 큰 패턴 주의

격리된 Worker는 느린 패턴 때문에 화면이 멈추지 않도록 돕지만 운영 환경에서 안전하다는 뜻은 아닙니다. 긴 입력과 악의적인 입력으로 과도한 백트래킹을 점검하세요.

샘플 데이터 처리 범위

패턴과 예제 텍스트는 로컬에서 처리되며 Devary 백엔드로 업로드되지 않습니다. 복사하거나 내보내서 다른 서비스에 붙여 넣는 행동은 별도입니다.

자주 묻는 질문

g 플래그를 사용하면 일치 개수가 달라지는 이유는?

g가 없으면 JavaScript는 일반적으로 첫 번째 일치만 반환합니다. g를 사용하면 Regex Lab이 텍스트 끝까지 추가 일치와 캡처 그룹을 수집합니다.

Python을 선택하면 Python 정규식이 실행되나요?

아니요. Python은 분석 대상일 뿐입니다. Regex Lab은 차이점을 알려 주고 코드 예제를 생성하지만 Python의 re 모듈에서 직접 실행하여 확인해야 합니다.

Regex Lab이 패턴의 안전성을 보장하나요?

아니요. 위험도 휴리스틱과 Worker 시간 제한은 실험에 도움이 되지만 정확성, 자원 사용량, 입력 검증은 실제 배포 환경에서 테스트해야 합니다.