LibreOffice 25.2 帮助
Regular expressions are special patterns used to find and manipulate text, helping you locate specific information within texts.
用正则表达式搜索与用通配符搜索不同。LibreOffice Writer 只支持使用正则表达式搜索。
在文档中查找与替换文字时,可以使用正则表达式。例如,「s.n」可以找到「sun」和「son」。
选择「
」。点击「
」展开对话框。选中「
」复选框。在「
」框中,输入要查找的关键词与正则表达式。点击「
」或「 」。代表单个字符的正则表达式是句点 (.)。
The regular expression for a word character \w, and \d for a decimal digit.
代表零或多个之前字符的正则表达式是星号。例如:「123*」可以找到「12」「123」以及「1233」。
The regular expression to search for zero or more occurrences of any character is a period and asterisk (.*).
The regular expression for one or more occurrences of the previous character is a plus sign (+). For example: "\w+" finds any word, "\d+" any number.
The regular expression for a tab character is \t. More generally, \s stands for all kinds of "spaces", like non-breaking space, carriage return ...
The regular expression for the end of a paragraph is a dollar sign ($). The regular expression for the start of a paragraph is a caret and a period (^.). The regular expression for an empty paragraph is ^$.
A search using a regular expression will work only within one paragraph. That is, a \n will match a line break within a paragraph.