Skip to content

[컴퓨터 과학] - [정규 표현식] #57

@co2plant

Description

@co2plant

📚 주제 (Topic)

정규 표현식(Regex)

🧑‍💻 발표자 (Presenter)

@co2plant

🗓️ 발표 예정일 (Presentation Date)

2025-11-12

🎯 학습 목표 및 범위 (Learning Goals & Scope)

기본 개념 및 이론적 배경

  • 정규 표현식이란 무엇인가? (정의)
  • 컴퓨터 과학(CS) 내 위치: 형식 언어(정규 언어)와 유한 오토마톤(FSM)의 관계 (이론)
  • Regex 엔진의 기본 개념 (NFA/DFA 언급)

핵심 문법 (Syntax) - POSIX ERE / PCRE 공통

  • 리터럴 (Literals): 일반 문자열 매칭
  • 메타 문자 (Meta-characters):
    • . (Any character)
    • | (Alternation / OR)
    • [] (Character Sets), [^] (Negated Sets)
    • () (Grouping)
  • 단축 표기 (Shorthands):
    • \d (Digit), \D (Non-Digit)
    • \w (Word character), \W (Non-Word character)
    • \s (Whitespace), \S (Non-Whitespace)
  • 수량자 (Quantifiers):
      • (0회 이상), + (1회 이상), ? (0회 또는 1회)
    • {n}, {n,m}, {n,} (특정 횟수 지정)
  • 경계 (Anchors):
    • ^ (Start of string), $ (End of string)
    • \b (Word boundary)

주요 개념 및 활용

  • Greedy vs. Lazy Quantifiers: *와 *?의 동작 차이
  • 그룹화와 캡처 (Grouping and Capturing): ()를 사용한 패턴 캡처 및 역참조(Back-reference)의 기본 개념 (e.g., \1)

실용 예제:

  • 유효성 검증 (Validation): 이메일, 비밀번호 형식 검증 패턴 분석 및 작성
  • 데이터 파싱 (Parsing): 로그 파일에서 IP 주소 또는 특정 에러 코드 추출

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions