Version: 5.0.1
18 Regular Expressions
(require unstable/regexp) |
This module provides tools for building strings which can be compiled to regular expressions. In particular, the constructors wrap their arguments in appropriate delimeters to prevent misparsing after concatenation.
| ||||||||||||||||||||||||||||
start : string? = "" | ||||||||||||||||||||||||||||
between : string? = "" | ||||||||||||||||||||||||||||
end : string? = "" | ||||||||||||||||||||||||||||
re : string? |
Produces a regular expression string that matches start, followed by
each re interleaved with between, followed by end.
Examples: | |||||||
| |||||||
> (regexp-match-exact? re "(1,10,100)") | |||||||
#t | |||||||
> (regexp-match-exact? re "(1,10)") | |||||||
#f | |||||||
> (regexp-match-exact? re " ( 1 , 10 , 100 ) ") | |||||||
#f |
Produces a regular expression string that matches any of the given res.
Examples: | ||
| ||
> (regexp-match-exact? re "123") | ||
#t | ||
> (regexp-match-exact? re "c") | ||
#t | ||
> (regexp-match-exact? re "12c") | ||
#f |
(regexp-maybe re ...+) → string? |
re : string? |
Produces a regular expression string that matches either the empty string, or
the concatenation of all the given res.
Examples: | ||
| ||
> (regexp-match-exact? re "123.456") | ||
#t | ||
> (regexp-match-exact? re "") | ||
#t | ||
> (regexp-match-exact? re "123") | ||
#f |
(regexp-star re ...+) → string? |
re : string? |
Produces a regular expression string that matches zero or more consecutive
occurrences of the concatenation of the given res.
Examples: | ||
| ||
> (regexp-match-exact? re "") | ||
#t | ||
> (regexp-match-exact? re "abc") | ||
#t | ||
> (regexp-match-exact? re "abcabcabc") | ||
#t | ||
> (regexp-match-exact? re "a") | ||
#f |
(regexp-plus re ...+) → string? |
re : string? |
Produces a regular expression string that matches one or more consecutive
occurrences of the concatenation of the given res.
Examples: | ||
| ||
> (regexp-match-exact? re "") | ||
#f | ||
> (regexp-match-exact? re "abc") | ||
#t | ||
> (regexp-match-exact? re "abcabcabc") | ||
#t | ||
> (regexp-match-exact? re "a") | ||
#f |
(regexp-save re ...+) → string? |
re : string? |
Produces a regular expression string that matches the concatenation of the given
res and saves the result.
Examples: | |||
| |||
> (regexp-match-exact? re "11") | |||
#t | |||
> (regexp-match-exact? re "123123") | |||
#t | |||
> (regexp-match-exact? re "123456") | |||
#f |
(regexp-multi re ...+) → string? |
re : string? |
Produces a regular expression string that matches the concatenation of the given
res in multiple-line mode.
Examples: | ||
| ||
> (regexp-match? re "abc") | ||
#t | ||
> (regexp-match? re "xyz\nabc\ndef") | ||
#t |