Regular Expressions: 두 판 사이의 차이
youngwiki
새 문서: 분류:계산 이론 개론 분류:컴퓨터 공학 상위 문서: Regular Languages ==개요== ==각주== |
편집 요약 없음 |
||
| 4번째 줄: | 4번째 줄: | ||
==개요== | ==개요== | ||
정규 표현식(regular expression)은 문자열에서 특정한 패턴을 찾거나 치환·검증하기 위해 사용하는 표현식이다. | |||
==Formal Definition of Regular Expressions== | |||
정규 표현식 집합 <math>\mathcal{RE}</math>는 알파벳 집합 <math>\Sigma</math>에 대해 아래의 닫힘 조건(closure conditions)을 만족하는 최소 집합을 의미한다: | |||
# <math>a \in \mathcal{RE},\,\, \forall a \in \Sigma</math> | |||
# 빈 문자열 <math>\epsilon</math>에 대해, <math>\epsilon \in \mathcal{RE}</math> | |||
# 어떤 문자열도 포함하지 않는 공집합 <math>\empty</math>에 대해, <math>\empty \in \mathcal{RE}</math> | |||
# Union: If <math>R_1 \in \mathcal{RE}, R_2 \in \mathcal{RE}</math>, then <math>(R_1 \cup R_2) \in \mathcal{RE}</math> | |||
# Concatenation: If <math>R_1 \in \mathcal{RE}, R_2 \in \mathcal{RE}</math>, then <math>(R_1 \circ R_2) \in \mathcal{RE}</math> | |||
# Kleene Star: If <math>R_1 \in \mathcal{RE}</math>, then <math>(R_1*) \in \mathcal{RE}</math> | |||
이때 정규 표현식은 단순히 문자열(strings)이며, <math>\{\empty, \epsilon, (, ), \cup, \circ, *\} \cup \Sigma</math>라는 알파벳 집합 위에서 정의된다. | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
<math></math> | |||
==각주== | ==각주== | ||
2025년 9월 28일 (일) 22:32 판
상위 문서: Regular Languages
개요
정규 표현식(regular expression)은 문자열에서 특정한 패턴을 찾거나 치환·검증하기 위해 사용하는 표현식이다.
Formal Definition of Regular Expressions
정규 표현식 집합 는 알파벳 집합 에 대해 아래의 닫힘 조건(closure conditions)을 만족하는 최소 집합을 의미한다:
- 빈 문자열 에 대해,
- 어떤 문자열도 포함하지 않는 공집합 에 대해,
- Union: If , then
- Concatenation: If , then
- Kleene Star: If , then
이때 정규 표현식은 단순히 문자열(strings)이며, 라는 알파벳 집합 위에서 정의된다.