[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Pattern matching: good practices ?
- From: David Manura <dm.lua@...>
- Date: Sat, 26 Dec 2009 12:29:27 -0500
On Sat, Dec 26, 2009 at 2:09 AM, David Manura wrote:
> ('a'):rep(1000):match'.*.*b'
That description actually would apply more to
('a'):rep(1000):match'^.*.*b' . Failure to anchor ^, allows the match
to start at any position in the string, which implies additional
backtracking. Example:
('a'):rep(5000):match'a*b' -- fails slowly (about a second)
('a'):rep(5000):match'^a*b' -- fails quickly