These procedures are in structures posix-regexps
and posix
.
An abstract data type for creating POSIX regular expressions is described in section *.
Make-regexp
makes a new regular expression, using string
as the pattern.
The possible option names are:
extended
use the extended patterns ignore-case
ignore case when matching submatches
report submatches newline
treat newlines specially
The regular expression is not compiled until it matched against a string, so any errors in the pattern string will not be reported until that point.
This is a predicate for regular expressions.(regexp-match regexp string submatches? starts-line? ends-line?)
-> boolean or list of matches
(match? x) -> boolean
(match-start match) -> integer
(match-end match) -> integer
Regexp-match
matches the regular expression against the characters
in string
.
If the string does not match the regular expression, regexp-match
returns #f
.
If the string does match, then a list of match records is returned
if submatches?
is true, or #t
is returned if it is not.
Each match record contains the index of the character at the beginning
of the match and one more than the index of the character at the end.
The first match record gives the location of the substring that matched
regexp
.
If the pattern in regexp
contained submatches, then the results
of these are returned in order, with a match records reporting submatches
that succeeded and #f
in place of those that did not.
Starts-line?
should be true if string
starts at the beginning
of a line and ends-line?
should be true if it ends one.
Previous: I/O | Next: C to Scheme correspondence