Python Regular Expression Quick Guide
^ Matches the beginning of a line
$ Matches the end of the line
. Matches any character
\s Matches whitespace
\S Matches any non-whitespace character
* Repeats a character zero or more times
*? Repeats a character zero or more times
(non-greedy) <- 최소일치로 찾기
+ Repeats a character one or more times
+? Repeats a character one or more times
(non-greedy)
[aeiou] Matches a single character in the listed set
[^XYZ] Matches a single character not in the listed set
[a-z0-9] The set of characters can include a range
( Indicates where string extraction is to start
) Indicates where string extraction is to end
>>> import re
>>> x = "From: louis@media.berkeley.edu"
>>> re.findall("^From.*\s(\S+)@(\S+)", x)
[('louis', 'media.berkeley.edu')]
>>> x = "From louis@media.berkeley.edu"
>>> re.findall("^From.*\s(\S+)@(\S+)", x)
[('louis', 'media.berkeley.edu')]
>>> _match = re.search("^From.*\s(\S+)@(\S+)", x)
>>> _match.group()
'From: louis@media.berkeley.edu'
>>> _match.groups()
('louis', 'media.berkeley.edu')
정규식 1
|
2019.08.23 14:57:54
|
2023.04.17 13:36:32
|
311
|
Aiden
Total of Attached file
0.00 Bytes of 0 files
2019.08.30
2019.08.29
2019.08.29
2019.08.28
2019.08.23
2019.08.23
2019.08.21
2019.08.21
2017.03.18
2017.03.01
2017.02.18