Regular expression syntax
OmniOutliner's Find dialog supports the use of some simple regular expressions. A regular expression is a single string that represents a whole set of strings. The following syntax is used:
a*
— zero or more instances of
a
(matches the longest string possible)
a*?
— zero or more instances of
a
(matches the shortest string possible)
a+
— one or more instances of
a
(matches the longest string possible)
a+?
— one or more instances of
a
(matches the shortest string possible)
a?
— zero or one instance of
a
^
— beginning of a row
$
— end of a row
.
— any character
[a-z]
— all characters between
a
and
z
[abc-]
—
a
,
b
,
c
, or
-
(abc)
— matches abc and stores it as a group. Use the
Select or Replace
pop-up menu in OmniOutliner's Find dialog to select or replace only one of these groups rather than the whole expression.
\1
— text of first matched group
a|b
—
a
or
b
\n
— newline
\r
— carriage return
\t
— tab character
\d
— digit
\D
— non-digit
\w
— word character (alphanumeric or underscore)
\W
— non-word character
\s
— whitespace
\S
— non-whitespace
\
— escape the next character
Regular expressions are very popular, so you should be able to find plenty of information about them on the internet or in a good library or bookstore. Here are a few examples to get you started:
\s*$
— matches whitespace at the end of a row.
<.*?>
— matches strings that begin with
<
and end with
>
, such as XML tags.
\S+@\S+
— very liberally matches things that resemble e-mail addresses (anything@anything).
(19|20)\d\d-\d\d?-\d\d?
— matches dates in the format
YYYY-MM-DD
, between 1900 and 2099