正则表达式不匹配表达式

时间:2018-08-20 14:03:53

标签: python regex python-3.x

我正在尝试找到[]之间的任何东西,这是到目前为止我无法使用的东西。我知道我可以使用string.find("[")来获得职位,但是我正在尝试更好地使用正则表达式。

string = '[12/Aug/2000:06:29:11 -]'
pattern = re.compile(r'[\[][.][\]]')
matches = pattern.finditer(string)
for match in matches:
    print(match)

0 个答案:

没有答案
相关问题