All Manuals > LispWorks® User Guide and Reference Manual > 38 The LISPWORKS Package

precompile-regexp Function

Summary

Precompiles a regular expression object.

Package

lispworks

Signature

precompile-regexp string &key case-sensitive space-string error-function => pattern, condition-designators

Arguments
string
A string.
case-sensitive
A generalized boolean.
space-string
nil (the default), t or a regexp string.
error-function
nil or a function that takes arguments like error.
Values
pattern
condition-designators
A list.
Description

The function precompile-regexp returns a precompiled regular expression object (a precompiled-regexp) suitable for passing as pattern to functions like find-regexp-in-string.

case-sensitive controls whether string is precompiled as a case sensitive or case insensitive search. A non-nil value means a case sensitive pattern. The value nil (the default) means a case insensitive pattern.

When space-string is non-nil, then string is precompiled to do a "Lax whitespace" search. That means that any sequence of space characters in string is effectively replaced by the regexp specified by space-string. If space-string is t, it specifies a regexp that matches "whitespace", specifically any non-empty sequence of the space, tab, return or newline characters.

error-function is used when the string is not a legal regular expression. In this case, if error-function is not nil, it is applied to a list of arguments which are designators for a condition like the arguments that error takes. If error-function is nil, precompile-regexp returns nil as the first argument and the list of arguments as a second return value, condition-designators. error-function defaults to error.

Notes

For the regular expression syntax, see 28.7 Regular expression syntax.

See also

find-regexp-in-string
regexp-find-symbols
count-regexp-occurrences
editor:regular-expression-search
precompiled-regexp
precompiled-regexp-p


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41