Python3 [ Python ] 정규표현식 Table 및 우선순위 Special characters \ escape special characters . matches any character ^ matches beginning of string $ matches end of string [5b-d] matches any chars '5', 'b', 'c' or 'd' [^a-c6] matches any char except 'a', 'b', 'c' or '6' R|S matches either regex R or regex S () creates a capture group and indicates precedence Quantifiers * 0 or more (append ? for non-greedy) + 1 or more (append ? for non-gree.. 2022. 11. 1. [ python ] 정규표현식[5] Mastering Python Regular Expressions http://www.packtpub.com/ Authors : Félix López 제5장 Performance of Regular Expressions Benchmarking regular expressions with Python import re from time import time as now import cProfile # 함수 처리 과정 및 속도 측정 # 실행 속도 촉정 (ms) def test(f, *args, **kargs): start = now() f(*args, **kargs) print("The function %s lasted: %.12fms" % (f.__name__, (now() - start)*10**3)) .. 2022. 10. 31. [ python ] 정규표현식[2] Mastering Python Regular Expressions http://www.packtpub.com/ Authors : Félix López 제2장 Regular Expressions with Python 0. A brief introduction 1) 정규표현식 Test Site 추천 https://regex101.com/: 정규표현식 테스트 및 코드 생성 가능 https://regexr.com/ : 다른 언어에서 가장 대중적 Site 구글 colab : 온라인 코딩 Test site 2) 정규표현식를 이용한 검색 작업 순서 import re # 정규표현식 모듈 re ( 내장 모듈 ) import expr = "[a-f]" # 정규표현식 작성 pattern = re.compile(expr) #.. 2022. 10. 27. 이전 1 다음