Returns a list of symbols that match a supplied regular expression.
lispworks
regexp-find-symbols pattern &key case-sensitive packages test external-only => symbols
pattern⇩ |
A string or a precompiled-regexp. |
case-sensitive⇩ |
A boolean. |
packages⇩ |
A list of package designators, a single package designator, or the keyword :all . |
test⇩ |
A function of one argument returning a boolean result. |
external-only⇩ |
A generalized boolean. |
symbols⇩ |
A list of symbols. |
The function regexp-find-symbols
returns a list of symbols that match the regular expression in pattern.
pattern should be a precompiled-regexp or a string. If pattern is a string then regexp-find-symbols
first makes a precompiled-regexp object. This operation allocates, therefore if you need to repeatedly call regexp-find-symbols
with the same pattern, it is better to call precompile-regexp once and pass its result, a precompiled-regexp, as pattern.
case-sensitive controls whether a string pattern is precompiled as a case sensitive or case insensitive search. A non-nil value means a case sensitive search. The value nil
(the default) means a case insensitive search. case-sensitive is ignored if pattern is not a string.
packages specifies in which packages to search. The default value of packages is :all
, meaning search in all packages.
test, if supplied, must be a function of one argument, which returns t
if the argument should be returned, and nil
otherwise. The function test is applied to each symbol that matches pattern, and if it returns nil
the symbol is not included in the returned value symbols. If test is nil
all matches are returned. The default value of test is nil
.
external-only, if true, specifies that only external symbols should be checked, which makes the search much faster. The default value of external-only is nil
.
The regular expression syntax used by regexp-find-symbols
is similar to that used by Emacs, as described in 28.7 Regular expression syntax.
To find all exported symbols that start with DEF:
(lw:regexp-find-symbols "^def" :external-only t)
To find all symbols that contain lower case "slider":
(regexp-find-symbols "slider" :case-sensitive t)
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41