3 Match and Range
A range expression is specified as char1 - char2, where all characters between the first and second character are considered, inclusively. A match expression is a set of characters, ranges, where any member of the set matches.
value
The range operator is the - in char1 - char2.
value
char>=/c : contract?
A contract used in rx/range which ensures the second parameter is greater than, or equal to, the first.
Create a character range including all characters in from ... to.
Examples:
> (rx/range #\A #\F) "A-F"
> (rx/range #\F #\A) to-char: contract violation
expected: char>=? #\F
given: #\A
Create multiple rx/ranges at the same time.
Example:
> (rx/ranges '(#\A . #\F) '(#\F . #\A)) to-char: contract violation
expected: char>=? #\F
given: #\A
A predicate that returns true if expr is a valid range string.
Create a match expression that matches any character specified in the match set. The set can be denoted as single
char?s, single-character string?s, or unbounded strings.
Examples:
A predicate that returns true if expr is a valid match string.
value
The string used as an operator to negate a match expression.
procedure
(rx/not-match expr ...) → string?
expr : string?
procedure
expr : string?
Create a negated match expression that matches any character not specified in the match set.
Examples:
> (rx/not-match "a" "b" "cd") "[^abcd]"
> (rx/^match "a" "b" "cd") "[^abcd]"
procedure
(rx/not-match? expr) → boolean?
expr : string?
A predicate that returns true if expr is a valid negated match string.
procedure
(rx/match-range from to) → string?
from : char? to : char?
Create a match expression which matches the range of characters in from ... to.
Examples:
> (rx/match-range #\x #\z) "[x-z]"
> ((compose rx/match rx/range) #\x #\z) "[x-z]"
procedure
(rx/not-match-range from to) → string?
from : char? to : char?
procedure
(rx/^match-range from to) → string?
from : char? to : char?
Create a match expression which matches any character except those in from ... to.
Examples:
> (rx/not-match-range #\g #\p) "[^g-p]"
> (rx/^match-range #\g #\p) "[^g-p]"
TBD
Examples:
> (rx/escape "-") "\\-"
> (rx/escape "|") "|"
> (rx/escape "-" 'outside-match) "-"
> (rx/escape "|" 'outside-match) "\\|"
3.1 Named Ranges
value
value
A pre-defined range, and match, for ASCII lower-case letter characters. Equivalent to [a-z].
value
value
A pre-defined range, and match, for ASCII upper-case letter characters. Equivalent to [A-Z].
value
value
A pre-defined range, and match, for ASCII upper-case and lower-case letter characters. Equivalent to [A-Za-z].
value
value
A pre-defined range, and match, for ASCII decimal digit characters. Equivalent to [0-9].
value
value
A pre-defined range, and match, for ASCII alpha-numeric characters. Equivalent to [A-Za-z0-9].
value
value
A pre-defined range, and match, for ASCII hex digit characters. Equivalent to [0-9A-Fa-f].
value
value
A pre-defined range, and match, for ASCII word characters. Equivalent to [A-Fa-f0-9_].