[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Patterns
- From: "Leinen, Rick" <RLeinen@...>
- Date: Fri, 30 Sep 2016 20:00:27 +0000
Thanks.
Sent from my iPhone
> On Sep 30, 2016, at 12:49 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> 2016-09-30 21:39 GMT+02:00 Leinen, Rick <RLeinen@leviton.com>:
>
>> t = {}
>> s = "from=world, to=Lua"
>> for k, v in string.gmatch(s, "(%w+)=(%w+)") do
>> t[k] = v
>> end
>
>> However, I would also like to allow “_” in the characters before and after
>> the “=”. I have read through the Patterns section, but have not come up
>> with a working character class modification to do the job. Can this be
>> done?
>
> ([_%w]+) allows any number of underscores anywhere.
> (%w+_?) allows an optional underscore at the end.
>