This library implementes BRE regex replacements on top of the existing posix-regex library.
Edward parser combinators for parsing replacement strings.
Parse a replacement string within text enclosed with the delimiter
delim
. While the combinator does not parse the enclosed character,
it ensures that this delim
character is escaped (using a \
)
within the replacement.
Refer to the documentation of the ed substitute command for more information on special character support within the replacement. All of these special characters can also be escaped.
(parse-replace delim)
Procedures for performing replacements using a parsed replacement string.
Replace nth
occurrence of regex
in str
with subst
. If nth
is zero, all occurrences are replaced. Returns two results: The string
after performing all replacement and a boolean indicating if any
replacements were successfully performed. The regex
must be
created using make-regex, while the replacement string
subst
must be parsed using parse-replace.
(regex-replace regex subst str nth)