lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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