re.match(pattern, string, flags=0)

If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding MatchObject instance. Return None if the string does not match the pattern; note that this is different from a zero-length match.

Note that even in MULTILINE mode, re.match() will only match at the beginning of the string and not at the beginning of each line.

If you want to locate a match anywhere in string, use search() instead (see also search() vs. match()).


'리눅스 > 스크립트/유틸' 카테고리의 다른 글

[screen/byobu] 윈도우 숫자 바꾸기  (0) 2013.06.29
[파이썬] String 가지고 놀기  (0) 2013.06.04
python, tempfile.mkdtemp  (0) 2013.04.28
python, getopt  (0) 2013.04.21
python, pass statement  (0) 2013.04.17
Posted by code cat