[New-bugs-announce] [issue36510] Regular Expression Dot-Star patter matching - re- text skipping
DJR
report at bugs.python.org
Tue Apr 2 14:06:08 EDT 2019
New submission from DJR <Drossi4 at its.jnj.com>:
#Python 3.7.2 Tk version 8.6.8
#IDLE version: 3.7.2
#Following code does not return ALL the partial matched patters within a string
import re
#_____________
#Normal Mode
#_____________
atRegex = re.compile(r'...at')
TextStr=(atRegex.findall(':at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat.'))
print('\nFull Text String:---> :at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat\n')
print('\n Normal Mode: Returns\n' + ':--->' + str(TextStr))
#_____________
#Greedy Mode
#_____________
atRegex = re.compile(r'...at*')
TextStr=(atRegex.findall(':at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat.'))
print('\nFull Text String:---> :at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat mat\n')
print('\n Greedy Mode: Returns\n' + ':---> ' + str(TextStr)+'\n')
"""
#===================================================================
# IDLE OutPut Normal Mode and Greedy Mode: multiple 'sat' are missing
#===================================================================
Full Text String:---> :at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat.
Normal Mode: Returns
:---> ['at-at', 'igcat', 'e hat', ' flat', 't mat']
Full Text String:---> :at-at~at: The Bigcat sat in the hat sat on the flat sat mat sat.
Greedy Mode: Returns
:---> ['at-at', 'igcat', 'e hat', ' flat', 't mat']
"""
----------
assignee: terry.reedy
components: IDLE, Library (Lib), Regular Expressions, Windows
messages: 339357
nosy: djr_python, ezio.melotti, mrabarnett, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Regular Expression Dot-Star patter matching - re- text skipping
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36510>
_______________________________________
More information about the New-bugs-announce
mailing list