|
Use wildcards (regular expressions)
Wildcards (also known as regular expressions) are combinations of characters that instruct OOo how to search for something. Regular expressions are very powerful but not very intuitive. They can save time and effort by combining multiple finds into one.
Table 1 shows a few of the regular expressions used by OOo.
TIP
|
The online help describes many more regular expressions and their uses.
|
Note
|
To search for a character that is defined as a wildcard, type a backslash (\) before the character. For example, to find the text $5.00, you would search for \$5\.00.
|
To use wildcards and regular expressions when searching and replacing:
-
On the Find & Replace dialog box, click More Options to see more choices. On this expanded dialog box (Figure 49), select the Regular expressions checkbox.
-
Type the search text, including the wildcards, in the Search for box and the replacement text (if any) in the Replace with box. Not all regular expressions work as replacement characters; the line break (\n) is one that does work.
-
Click Find, Find All, Replace, or Replace All (not recommended).
Table 1. Examples of search wildcards (regular expressions)
To find
|
Use this expression
|
Examples and comments
|
Any single character
|
.
|
b.d finds bad, bud, bid, and bed.
|
Any string of characters
|
.*
|
b.*d finds bad, brand, and board.
|
One of the specified characters
|
[ ]
|
b[iu]n finds bin and bun.
|
Any single character in this range
|
[-]
|
[r-t]eed finds reed, seed, and teed; ranges must be in alphabetically ascending order.
|
Any single character except the characters inside the brackets
|
[^]
|
p[^a]st finds post and pest, but not past.
|
The beginning of a word
|
\<
|
\<log finds logbook and logistics, but not catalog.
|
The end of a word
|
\>
|
log\> finds catalog, but not logistics.
|
A paragraph marker
|
$
|
Does not work as a replacement character. Use \n instead.
|
A line break
|
\n
|
Finds a line break that was inserted with Shift+Enter. When used as a replacement character, it inserts a paragraph marker.
|
|
|