chickadee » irregex » string->irregex

(irregex <posix-string-or-sre> [<options> ...])procedure
(string->irregex <posix-string> [<options> ...])procedure
(sre->irregex <sre> [<options> ...])procedure

Compiles a regular expression from either a POSIX-style regular expression string (with most PCRE extensions) or an SCSH-style SRE. There is no (rx ...) syntax - just use normal Scheme lists, with quasiquote if you like.

Technically a string by itself could be considered a valid (though rather silly) SRE, so if you want to just match a literal string you should use something like (irregex `(: ,str)), or use the explicit (sre->irregex str).

The options are a list of any of the following symbols:

'i, 'case-insensitive
match case-insensitively
'm, 'multi-line
treat string as multiple lines (effects ^ and $)
's, 'single-line
treat string as a single line (. can match newline)
'utf8
utf8-mode (assumes strings are byte-strings)
'fast
try to optimize the regular expression
'small
try to compile a smaller regular expression
'backtrack
enforce a backtracking implementation

The 'fast and 'small options are heuristic guidelines and will not necessarily make the compiled expression faster or smaller.