lua-users home
lua-l archive

Re: Patterns

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


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.
> 

AltStyle によって変換されたページ (->オリジナル) /