New submission from 赵豪杰 <1292756...@qq.com>:

```
>>> 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

----------
components: Regular Expressions
messages: 381689
nosy: HaujetZhao, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.findall have different match result against re.search or re.sub
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42448>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to