Matches the string passed literally. Use
lbuilder.l to create one.
-- Anonymous literal local literal = lbuilder.l "Hello" -- Named literal local namedLiteral = lbuilder.l ("example:hello", "Hello") -- Short naming local shortNamedLiteral = lbuilder.l "Hello" ["example:hello"]
Since 1.1, this will escape all magic characters
As of 1.3, all particles can be named with indexing
Matches the string passed as a pattern. Use
lbuilder.n to create one.
Creates a set of characters, supports ranges. Use
lbuilder.s to create one.
-- Anonymous sets local vowels = lbuilder.s "aeiou" local alphabet = lbuilder.s "a-z" -- Named sets local _alphabet = lbuilder.s ("alphabet", "a-z") -- Negated sets local notAlphabet = lbuilder.s "a-z" (true)
Creates a capture, supports ranges. Use
lbuilder.c to create one.
-- Anonymous captures local cvowels = lbuilder.c (vowels) -- Named captures local calphabet = lbuilder.c ("alphabet", alphabet)
You can optionally use
lbuilder.C to create a capture of a particle.
Joins two literals or normals.
l+l => ll
Joins two sets.
s+s => [ss]
Repeats the particle n times.
p/3 => ppp
Repeats the literal no more than n times.
p/-3 => ppp[^p]
Match the set once or more, as much as possible.
p/'+' => p+
Only works for literals and sets.
Match the set zero or more, as less as possible.
p/'-' => p-Only works for literals and sets.
Optionally match the set.
p/'?' => p?Only works for literals and sets.
Match the set zero or more, as much as possible.
p/'*' => p*
Only works for literals and sets
Negates a set.
-s => [^s]
Creates a pattern from the literal.
#l => P (l)