A string or precompiled regular expression object.
A string.
Bounding index designators of string.
A generalized boolean.
A generalized boolean.
The function count-regexp-occurrences
counts the occurrences of pattern in the part of string bounded by start and end.
If pattern is a string, count-regexp-occurrences
precompiles it first. If you use count-regexp-occurrences
with the same pattern string several times, it is better to precompile it using precompile-regexp.
start and end have the sames meaning as in count
and other Common Lisp sequence functions.
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.
If overlap is false (the default), then count-regexp-occurrences
counts matches that to not overlap. If overlap is non-nil, matches can overlap, and count-regexp-occurrences
finds all of the ways in which the pattern can be matched inside string.
The regular expression syntax used by count-regexp-occurrences
is similar to that used by Emacs, as described in the "Regular expression syntax" section of the
LispWorks Editor User Guide
. If you use
Help > Search
to locate this section in the LispWorks IDE, then select the
Contents
radio button.
(count-regexp-occurrences "aaa" "aaaaa")
=>
1
(count-regexp-occurrences "aaa" "aaaaa" :overlap t)
=>
3
(count-regexp-occurrences "12" "81267124")
=>
2
(count-regexp-occurrences "12" "81267124" :start 4)
=>
1
(let* ((path (example-file
"capi/elements/text-input-pane.lisp"))
(file-string (file-string path)))
(count-regexp-occurrences ":title" file-string))
=>
20 ; in LispWorks 7.1
LispWorks User Guide and Reference Manual - 20 Sep 2017