SRFI-115 Module

Scheme’s SRFI-115 defines a Regular Expressions library.

This is native Idio code and so is relatively slow compared to the standard library’s POSIX regex functionality. SRFI-115 offers more functionality.

This library uses sexp regular expressions (SREs) rather than the more common string based regular expression:

This format offers many advantages, including being easier to read and write (notably with structured editors), easier to compose (with no escaping issues), and faster and simpler to compile.

The SRE syntax is immediately different, being a list, but also because the iteration key, +, *, ?, etc., lead the term(s) they affect.

SRFI-115 has plenty of documentation and examples but some approximate [1] comparisons, noting : for a sequence of regexps and $ for submatches, are:

SRE

regex(7)

'(+ space)

"[[:space:]]+"

'(* "abc")

"(abc)*" [2]

'(: bol (* "ab") "c")

"^(ab)*c"

'(: ($ (* "ab")) "c" eol)

"((ab)*)c$" [3]

Last built at 2024-12-21T07:10:36Z+0000 from 62cca4c (dev) for Idio 0.3.b.6