4.19 Regular Expressions
The :std/pregexp library provides the Dorai Sitaram’s well known
portable Scheme regular expression library.
See the pregexp page for details of the regular expression language and examples.
usage
(import :std/pregexp)
4.19.1 pregexp
(pregexp regexp)
regexp := string; the regular expression
-> <pregexp>
Parse a string and compile it to a regular expression.
4.19.2 pregexp-match
(pregexp-match pat str [start #f] [end #f])
pat := <pregexp> or string; the regular expression to match
str := the string to match
start := start position in the string
end := end position in the string
-> list or #f
Match a string against a regular expression and return a list of matching substrings.
4.19.3 pregexp-match-positions
(pregexp-match-positions pat str [start #f] [end #f])
pat := <pregexp> or string; the regular expression to match
str := the string to match
start := start position in the string
end := end position in the string
-> list or #f
Match a string against a regular expression and return a list of index pairs where matches have occurred.
4.19.4 pregexp-split
(pregexp-split pat str)
pat := <pregexp> or string; the regular expression to match
str := the string to match
-> list
Split a string using a regular expression as delimiter and return a list of matching substrings.
4.19.5 pregexp-replace
(pregexp-replace pat str ins)
pat := <pregexp> or string; the regular expression to match
str := the string to match
ins := the string to insert
=> string
Replace the portion of a string matched by regular expression with another string.
4.19.6 pregexp-replace*
(pregexp-replace* pat str ins)
pat := <pregexp> or string; the regular expression to match
str := the string to match
ins := the string to insert
=> string
Like pregexp-replace but replaces all occurrences of the pattern
4.19.7 pregexp-quote
(pregexp-quote str)
str := a string
=> string
Takes an arbitrary string and returns a string regular expression that represents it precisely.