lua-users home
lua-l archive

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


On 14 March 2011 08:14, Benoit Germain <bgermain@ubisoft.fr> wrote:
>
>
>> -----Original Message-----
>> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
>> On Behalf Of Roberto Ierusalimschy
>> Sent: Thursday, March 10, 2011 3:00 PM
>> To: Lua mailing list
>> Subject: Re: How to extract a word at a given position in a string?
>>
>> What is wrong with reversing the string ('string.reverse')?
>>
>> -- Roberto
>
> [BG] Reversing the string is fine when it is rather small (which is my case).
> However, I suppose one can encounter a situation where a large text has to be searched,
> and there is no easy means of extracting a small portion to search in. In that case,
> duplicating the whole text, and searching through it, is expensive.
> I was just wondering if there was a possibility to apply all pattern matching functions
> in the reverse direction.

GNU regex allows this, and lrexlib 2.5.x supports backwards searching
when using it. GNU regex supports POSIX syntaxes.

-- 
http://rrt.sc3d.org