[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: string.find() question
- From: "Soni L." <fakedme@...>
- Date: Tue, 5 Sep 2017 16:55:57 -0300
On 2017-09-05 04:43 PM, Lev wrote:
I have some issues with string.find().
What do I miss?
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio
return string.find(str, '--d8eb6ad5-707f')
return string.find(str, '--d8eb6ad5-')
return string.find(str, '--d8eb6ad5-7')
I've tried that with 5.1, 5.2 and 5.3. All on Debian Stable, and also with 5.1 on some embedded platform on LEDE 17.01.1. Same result.
Any help welcome.
> return string.find(str, '--d8eb6ad5')
That's because - has a special meaning in Lua patterns:
A pattern item can be
- a single character class followed by '-', which also matches zero or
more repetitions of characters in the class. Unlike '*', these
repetition items will always match the shortest possible sequence;
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.