str = 'asd(hello)asd(world)'
s = re.search(r'(?<=\().*?(?=\))',str1)
print(s)
<re.Match object; span=(4, 9), match='hello'>
只能匹配出第一个 hello,如何匹配出所有()里的内容呢
1
masker 2018-11-22 15:40:44 +08:00 via Android
\w+\((.*?)\){1,}
|
2
sess222 2018-11-22 15:41:55 +08:00 1
懒惰匹配是虾米?
re.findall('\((.*?)\)', str1) |
6
Atukey 2018-11-22 16:14:11 +08:00
(?<=\()\w*(?=\))
|