lua-users home
lua-l archive

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


Hi all,

The problem du jour is to efficiently find single-word matches, that
is if we match 'dog' we don't match 'dogged'. Using %Wdog%W works most
of the time, but not at the ends of the string. Which is precisely
where the frontier pattern [1] is useful: '%f[%w]dog%f[%W].

Now %f is one of those problem children that may be dropped, see [2]

Any other way to do this without %f?  Yes, I know that artificially
adding spaces to the ends of the text will do the job but this would
be very inefficient for largish searches.

steve d.

[1] http://lua-users.org/wiki/FrontierPattern
[2] http://lua-users.org/lists/lua-l/2006-12/msg00536.html