데이터 분석/python
[Python] 정규표현식 기초
참치바나나
2021. 1. 27. 20:58
정규 표현식이란?
*Regular expression : 정규 표현식 : 정해진 규칙을 표현하는 식
python re , python regex 모듈
시작하기
import re
일단 기본
표현이 거지같아직관적이지 않아야 정규표현식 같다.
\d : digit : 숫자 : 0~9 에 해당 : [0-9] 와 같음
\D : not digit : 숫자 빼고 : [^0-9]
\w : word charactor : 글자 문자 : a ~z , A ~ Z, 0~9
\W : not word charactor
\s : white space : 스페이스
. : (점) : 아무거나 전부
괄호
[abd]
반복
ca*t
줄 글로 읽기
docs.python.org/3/howto/regex.html
Regular Expression HOWTO — Python 3.9.1 documentation
Introduction Regular expressions (called REs, or regexes, or regex patterns) are essentially a tiny, highly specialized programming language embedded inside Python and made available through the re module. Using this little language, you specify the rules
docs.python.org