~/devtools / regex / email
tool::regex-guide

regex email

/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i

이메일 주소 검증

ad · 728×90
정규식 패턴
/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i
플래그:i
패턴 분석
^Start of string
[a-zA-Z0-9._%+\-]+Local part: letters, digits, dots, special chars
@Literal @ symbol (required)
[a-zA-Z0-9.\-]+Domain name: letters, digits, dots, hyphens
\.Literal dot before TLD
[a-zA-Z]{2,}TLD: at least 2 letters (com, org, io…)
$End of string
매칭 예시
user@example.com
name.surname+tag@sub.domain.org
dev@company.io
비매칭 예시
user@
@domain.com
no-at-sign.com
user @example.com

RFC 5322 기반의 실용적인 이메일 주소 패턴입니다. 로컬 파트(@기호 앞)와 도메인 파트(@기호 뒤)로 나뉘며, 가장 일반적인 이메일 형식을 포괄합니다. 단, 국제화 도메인(IDN)이나 IP 주소 형식 도메인은 별도 처리가 필요합니다.

언어별 사용법

JavaScriptRegExp 객체 또는 리터럴 사용
const pattern = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i;

// Test a string
console.log(pattern.test("user@example.com")); // true
console.log(pattern.test("user@")); // false

// Match and extract
const result = "user@example.com".match(pattern);
Pythonre 모듈 사용
import re

pattern = r"^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$"
flags = re.IGNORECASE

# Test a string
if re.fullmatch(pattern, "user@example.com", flags):
    print("Valid")

# Find all matches in text
matches = re.findall(pattern, text, flags)
Javajava.util.regex 패키지 사용
import java.util.regex.*;

String pattern = "^[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}$";
Pattern p = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);

Matcher m = p.matcher("user@example.com");
boolean isValid = m.matches(); // true

// Find occurrences
Matcher finder = p.matcher(inputText);
while (finder.find()) {
    System.out.println(finder.group());
}

주요 사용 사례

  • 회원가입 폼 이메일 유효성 검증
  • 뉴스레터 구독 이메일 입력 검증
  • 데이터베이스 이메일 컬럼 형식 확인
  • CSV/엑셀 이메일 데이터 정제
  • API 요청 바디의 이메일 필드 검증

관련 패턴

phone/^\+?[\d\s\-\(\)]{7,15}$/url/^https?:\/\/[^\s\/$.?#].[^\s]*$/iip-address/^((25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\./date/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[/
ad · 300×250
Regex 테스터로 돌아가기
// related tools
Cron 표현식 생성기
Cron 표현식을 시각적으로 만들고 파싱합니다. 사람이 읽기 쉬운 설명과 다음 실행 시간을 미리 확인할 수 있습니다.
jwt
JWT 디코더
JWT 토큰을 디코딩하고 분석합니다. 헤더, 페이로드, 서명을 확인할 수 있습니다.
색상 변환기
HEX, RGB, HSL 등 다양한 형식으로 색상을 변환합니다.
ts
타임스탬프 변환기
Unix 타임스탬프와 날짜/시간을 양방향으로 변환합니다. ms/s, UTC/로컬, 상대 시간을 지원합니다.