lua-users home
lua-l archive

Re: How can I do PCRE-y stuff in Lua Patterns?

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


On 2017年10月01日 03:44 PM, Egor Skriptunoff wrote:
On Sun, Oct 1, 2017 at 2:41 AM, Soni L. wrote:
 local PATTERN = '%f[^ 0円]<<([^ ].-)>>%f[ 0円] ?'
     .. msg:gsub(PATTERN, '1円ACTION %11円'))
 And it works pretty good, except for e.g. "test <<thing>>" which
 gets sent as "test 1円ACTION thing1円" and I'd rather it be sent as
 "test1円ACTION thing1円".
Try
PATTERN = ' *%f[^ 0円]<<([^ ].-)>>%f[ 0円] *'
I think you forgot the second gsub that makes it look italics to me. The one with the goal of making it look like "test /thing/" instead of "test/thing/". I also want "test <<thing>> test" to become "test test" with a separate "thing" in an action (even if that action is between the 2 "test"), not "testtest" with a "thing" action. (But perhaps I should claim clients that display "test 1円ACTION thing1円 test" as "*thing\x0Atest\x20\x20test" are wrong...)
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.

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