(.using
  [library
   [lux "*"
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: /.regex
  "Create lexers using regular-expression syntax."
  ["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(.)(.)")])

(documentation: /.^regex
  "Allows you to test text against regular expressions."
  [(case some_text
     (^regex "(\d{3})-(\d{3})-(\d{4})"
             [_ country_code area_code place_code])
     do_some_thing_when_number

     (^regex "\w+")
     do_some_thing_when_word

     _
     do_something_else)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..regex
             ..^regex
             ($.default /.incorrect_quantification)]
            []))
