[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lrexlib regular expressions in LPEG Re
- From: Александр Машин <alex.mashin@...>
- Date: Sat, 30 Sep 2023 18:55:16 +0700
Dear all,
In case anybody is interested, I have added regular expressions to LPEG
Re module as used by traditio.wiki (later to be included into
FormatterII templating engine (https://github.com/alex-mashin/FormatterII)).
The syntax is:
{flavour/regular expression/flags}, where flavour is
pcre|pcre2|posix|onig|tre (subject to availability);
flags are [imsxUX]*
or:
{/regular expression/flags}, with the default flavour from re.rex_flavour.
The regular expression is not anchored, unless it starts from ^.
The captures from regex are propagated but named ones will become anonymous.
lpeg.Cmt is used, the implementation is at lines 175-202 and 292-311 of
https://traditio.wiki/Module:Re.
The motivation is that Re library can be used to build grammars from,
among other things, PECL masks for from an external source.
Alexander Mashin