Open Gethe opened 9 years ago
Lua regex is unfortunately too different and would require a great change in existing code as it stands right now. Maybe in the future, but it is unfortunately not very likely unless I decide to do a massive rehaul. I wonder why lua went with the syntax that they did..
It's been two years since this request and we've seen quite a bit of change to the site. Any chance that the possibility of adding support for Lua could be re-visited? :+1:
That depends on what regex engine lua uses, if it can be emulated with the existing ones or have its own ported to JS. Is there a complete link to the spec sheet?
I'm not sure if there's a full spec floating around, as the Lua documentation is very lax in general, but there's a reference here: https://www.lua.org/pil/20.2.html
It looks really simple, other than those weird percents it looks quite similar to normal regex.
@firasdib You asked above why they did it, they say in the docs that it's because the POSIX implementation is too long and theirs is just quarter of that in length.
We could potentially implement Lua as a shim on top of PCRE, since it looks like its a subset of PCRE anyway.
This would be nice !
I think this would be a great addition, as I often find myself backporting PCRE expressions I made on the site to Lua and banging my head on the discrepancies.
do you have a short-list of stuff you often run in to?
Any interest in restarting this discussion? I adore regex101 and Lua. I'll put $100 donation reward on this feature getting merged.
@joshenders I think this is too much work as of right now, unfortunately. Ideally I'd like to get C# working first.
@joshenders I think this is too much work as of right now, unfortunately. Ideally I'd like to get C# working first.
Now that the C# is done, any chance you will work on LUA? I recently started working heavily on Mediawiki and Wikibase: LUA is their scripting language of choice (via Scribunto) and it would be great to apply the power of Regex101 to it.
Thanks for your effort
i'd certainly like to see this added.
💯
Lua patterns have some interesting features of their own:
%bxy
where x
and y
and two distinct characters matches a sequence starts with x
and ends with y
so that the number of x
in that sequence is equals to the number of y
. This is somewhat similar to x(?:(?<c>x)|(?<-c>y)|[^xy])*(?(c)(?!))y
in .NET.%f[...]
where [...]
is a character set matches a position where the next character matches [...]
and the previous doesn't. A negated set (%f[^...]
) can be used to invert the order. Its regex equivalent is (?<![^...])(?=[...]|$)
.However, their quirks far outweight the features: Lua is not very internationalized by design. Lua patterns match by bytes and metasequences like %a
(letters) are only ASCII-aware. For example, ('Á'):match('%a')
returns nil
whereas ('Á'):match('%A')
returns the first byte. If Lua patterns were to be added to the bunch, these will need to be fully addressed.
Ten years passed, is there any update of this topic?
I am still interested as well. This is such a wonderful tool! Thank you.
Would be nice to have this feature
I would love to see support for Lua on this site. http://www.lua.org/pil/20.1.html