All Manuals > LispWorks IDE User Guide > 3 Common Features

NextPrevUpTopContentsIndex

3.13 Regexp matching

Regular expressions (regexps) can be used when searching and filtering throughout the IDE. This section describes exactly how LispWorks regexp matching operates.

3.13.1 Regular expression syntax

.

Matches any single character except a newline. For example, c.r matches any three character string starting with c and ending with r.

*

Matches the previous regexp any number of times (including zero times). For example, ca*r matches strings beginning with c and ending with r, with any number of as in-between.

+

Matches the previous regexp any number of times, but at least once. For example, ca+r matches strings beginning with c and ending with r, with at least one a in-between.

?

Matches the previous regexp either 0 or 1 times. For example, ca?r matches either the string cr or car, and nothing else.

^

Matches the next regexp as long as it is at the beginning of a line. For example, ^foo matches the string foo as long as it is at the beginning of a line.

$

Matches the previous regexp as long as it is at the end of a line. For example, foo$ matches the string foo as long as it is at the end of a line.

[ ]

Contains a character set to be used for matching, where the other special characters mentioned do not apply. The empty string is automatically part of the character set. For example, [a.b] matches either a or . or b or the empty string. The regexp c[ad]*r matches strings beginning with c and ending with r , with any number of as and ds in-between.

The characters - and ^ have special meanings inside character sets. - defines a range and ^ defines a complement character set. For example, [a-d] matches any character in the range a to d inclusive, and [^ab] matches any character except a or b.

\

Quotes the special characters. For example, \* matches the character * (that is, * has lost its special meaning).

\|

Specifies an alternative. For example, ab\|cd matches either ab or cd.

\( , \)

Provides a grouping construct. For example, ab\(cd\|ef\) matches either abcd or abef.

3.13.2 Regexp and plain string matching

Sometimes you need to select an option to use regexp matching, as the default behavior uses a plain string comparison. For example, see Advanced Filtering.

Other areas always use regexp matching, such as the search target in some modes of the The Search Files tool, and editor commands with names containing "Regexp".


LispWorks IDE User Guide (Windows version) - 13 Sep 2017

NextPrevUpTopContentsIndex