bo qu added the comment:
hi Serhiy Storchaka
thank you for your explanation, it helps a lot
2017-04-01 15:44 GMT+08:00 Serhiy Storchaka :
>
> Serhiy Storchaka added the comment:
>
> re.match() checks if the beginning of the string matches the regular
> expression
Serhiy Storchaka added the comment:
re.match() checks if the beginning of the string matches the regular expression
pattern. Use re.search() if you want to find the match not at the beginning of
the string.
https://docs.python.org/3/library/re.html#re.match
New submission from bo qu:
if "[" is the first char in a string, then re.match can't match any pattern
from the string, but re.findall works fine
details as follows:
[da@namenode log]$ python3
Python 3.4.3 (default, Jun 14 2015, 14:23:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type