[issue28690] Loop in re (regular expression) processing

Walter Farrell report at bugs.python.org
Mon Nov 14 11:24:47 EST 2016


New submission from Walter Farrell:

Given:
  pattern = r"(^|[^\\])<(pm [^ ]+( +|'[^']*'|\"[^\"]*\"|[^>]+)+)>"
  s = "<b>Bain, F. W.</b> <pm href 'Digit of the moon, and other"

import re
  m = re.search(pattern, s)

The re.search call seems to loop, never returning (or, at least never returning as long as I was willing to wait).

Note that with a ">" added to the end of s, it returns quickly with a match. Without the ">" it should fail, but instead seems to loop.

(If I use the regex module instead of re, it fails properly and quickly.)

Python 3.5.1, Windows 10:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32

----------
components: Library (Lib), Regular Expressions
messages: 280790
nosy: Walter Farrell, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Loop in re (regular expression) processing
type: resource usage
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28690>
_______________________________________


More information about the Python-bugs-list mailing list