Message381689
```
>>> import re
>>> text = '121212 and 121212'
>>> pattern = '(12)+'
>>> print(re.findall(pattern, text))
['12', '12']
>>>
>>>
>>> print(re.search(pattern, text))
<re.Match object; span=(0, 6), match='121212'>
>>>
>>>
>>> print(re.sub(pattern, '', text))
and
# The re.findall have different search result against re.search or re.sub
# re.findall 和 re.search 、 re.sub 的匹配结果不相同
```
With same pattern and string, the re.findall is supposed to have same match with re.search, but it didn't.
This result is from python3.8.5 |
|
Date |
User |
Action |
Args |
2020-11-23 19:30:57 | HaujetZhao | set | recipients:
+ HaujetZhao, ezio.melotti, mrabarnett |
2020-11-23 19:30:57 | HaujetZhao | set | messageid: <1606159857.65.0.962689074974.issue42448@roundup.psfhosted.org> |
2020-11-23 19:30:57 | HaujetZhao | link | issue42448 messages |
2020-11-23 19:30:57 | HaujetZhao | create | |
|