lux/regex

Macros

regex

## Create lexers using regular-expression syntax.
## For example:
## Literals
(regex "a")

## Wildcards
(regex ".")

## Escaping
(regex "\\.")

## Character classes
(regex "\\d")

(regex "\\p{Lower}")

(regex "[abc]")

(regex "[a-z]")

(regex "[a-zA-Z]")

(regex "[a-z&&[def]]")

## Negation
(regex "[^abc]")

(regex "[^a-z]")

(regex "[^a-zA-Z]")

(regex "[a-z&&[^bc]]")

(regex "[a-z&&[^m-p]]")

## Combinations
(regex "aa")

(regex "a?")

(regex "a*")

(regex "a+")

## Specific amounts
(regex "a{2}")

## At least
(regex "a{1,}")

## At most
(regex "a{,1}")

## Between
(regex "a{1,2}")

## Groups
(regex "a(.)c")

(regex "a(b+)c")

(regex "(\\d{3})-(\\d{3})-(\\d{4})")

(regex "(\\d{3})-(?:\\d{3})-(\\d{4})")

(regex "(?<code>\\d{3})-\\k<code>-(\\d{4})")

(regex "(?<code>\\d{3})-\\k<code>-(\\d{4})-\\0")

(regex "(\\d{3})-((\\d{3})-(\\d{4}))")

## Alternation
(regex "a|b")

(regex "a(.)(.)|b(.)(.)")