These procedures are in structures
An abstract data type for creating POSIX regular expressions is described in section *.
Make-regexpmakes a new regular expression, using
stringas the pattern. The possible option names are:
use the extended patterns
ignore case when matching
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.
(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-matchmatches the regular expression against the characters in
string. If the string does not match the regular expression,
#f. If the string does match, then a list of match records is returned if
submatches?is true, or
#tis 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
regexpcontained submatches, then the results of these are returned in order, with a match records reporting submatches that succeeded and
#fin 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