accelmo.machine.patterns

Element-name patterns: the accelerators write Lua patterns, other backends match them as regex.

accelmo.machine.patterns.lua_to_regex(pattern)[source]

Compile a Lua pattern as a regex with the same matches (use .search, as string.match).

Supports anchors, ., % classes and escapes, sets [...]/[^...], the quantifiers * + ? - and captures. Raises ValueError on %b, %f and back-references.

Return type:

Pattern[str]

Parameters:

pattern (str)