lua-users home
lua-l archive

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


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.