[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: String usage doubt
- From: Pierre-Yves Gérardy <pygy79@...>
- Date: Wed, 25 Jun 2014 12:47:36 +0200
On Wed, Jun 25, 2014 at 12:41 PM, Austin Einter <email@example.com> wrote:
> I am trying to find the location of a sub string in main string.
> The sub string is "Max-Forwards"
> offset = string.find(msg, "Max-Forwards")
In Lua patterns, the minus is a non-greedy version of the "*".
You can escape it with % => "Max%-Forwards", but in your case, since
you're looking for a plain string, you can use the "plain" option of
offset = string.find(msg, "Max-Forwards", 1, true) -- subject, needle,
start position, plain?