Limits on search length

Florian Schmidt schmidt_florian at gmx.de
Mon Oct 1 14:33:28 EDT 2007


On Mon, Oct 01, 2007 at 11:16:49AM -0600, Daryl Lee wrote:
> ... But I have some very long ones, and a pattern like 
> r'".{272}"' fails miserably, even though I know I have at least one 
> 272-character string.

~>python
Python 2.4.4 (#2, Apr 26 2007, 00:02:45) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> data = "-" * 1024 + "l" * 272 + "*" * 1024
>>> m = re.search("l{272}", data)
>>> m.start(), m.end()
(1024, 1296)
or even bigger:
>>> data = "-" * 1024 + "l" * 2048+ "*" * 1024
>>> m = re.search("l{2048}", data)
>>> m.start(), m.end()
(1024, 3072)

so i dont think you are hitting an re matching limit.

could you post your searchPattern?

-- 
Florian Schmidt	// www.fastflo.de




More information about the Python-list mailing list