[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Patterns
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 30 Sep 2016 21:48:58 +0200
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.