1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************
-->
<meta>
<topic id="textshared0102100001xml" indexer="include" status="PUBLISH">
<title xml-lang="en-US" id="tit">List of Regular Expressions</title>
<filename>/text/shared/01/02100001.xhp</filename>
</topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3146765"><bookmark_value>regular expressions; list of</bookmark_value>
<bookmark_value>lists;regular expressions</bookmark_value>
<bookmark_value>replacing;tab stops (regular expressions)</bookmark_value>
<bookmark_value>tab stops;regular expressions</bookmark_value>
<bookmark_value>concatenation, see ampersand symbol</bookmark_value>
<bookmark_value>ampersand symbol, see also operators</bookmark_value>
</bookmark><comment>mw added "replacing;" and "tab stops;"</comment>
<paragraph xml-lang="en-US" id="hd_id3146765" role="heading" level="1" l10n="U"
oldref="203"><variable id="02100001"><link href="text/shared/01/02100001.xhp">List of Regular Expressions</link>
</variable></paragraph>
<table id="tbl_id3149517">
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3149741" role="tablehead" l10n="U" oldref="17">Character</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3155577" role="tablehead" l10n="U" oldref="18">Result/Use</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id6600543" role="tablecontent" l10n="NEW">Any character</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id9824518.00000001" role="tablecontent" l10n="CHG">Represents the given character unless otherwise specified.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3152427" role="tablecontent" l10n="U" oldref="19">.</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3149031" role="tablecontent" l10n="CHG" oldref="20">Represents any single character except for a line break or paragraph break. For example, the search term "sh.rt" returns both "shirt" and "short".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3154682" role="tablecontent" l10n="CHG" oldref="21">^</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3155351" role="tablecontent" l10n="CHG" oldref="22">Only finds the search term if the term is at the beginning of a paragraph. Special objects such as empty fields or character-anchored frames, at the beginning of a paragraph are ignored. Example: "^Peter".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3159194" role="tablecontent" l10n="CHG" oldref="23">$</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3152542" role="tablecontent" l10n="CHG" oldref="24">Only finds the search term if the term appears at the end of a paragraph. Special objects such as empty fields or character-anchored frames at the end of a paragraph are ignored. Example: "Peter$".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3156414" role="tablecontent" l10n="U" oldref="25">*</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3155555" role="tablecontent" l10n="CHG" oldref="26">Finds zero or more of the characters in front of the "*". For example, "Ab*c" finds "Ac", "Abc", "Abbc", "Abbbc", and so on.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147399" role="tablecontent" l10n="U" oldref="27">+</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3157958" role="tablecontent" l10n="CHG" oldref="28">Finds one or more of the characters in front of the "+". For example, "AX.+4" finds "AXx4", but not "AX4".</paragraph>
<paragraph xml-lang="en-US" id="par_id3145313" role="tablecontent" l10n="U" oldref="207">The longest possible string that matches this search pattern in a paragraph is always found. If the paragraph contains the string "AX 4 AX4", the entire passage is highlighted.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3143267" role="tablecontent" l10n="U" oldref="199">?</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153684" role="tablecontent" l10n="CHG" oldref="200">Finds zero or one of the characters in front of the "?". For example, "Texts?" finds "Text" and "Texts" and "x(ab|c)?y" finds "xy", "xaby", or "xcy".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3166410" role="tablecontent" l10n="U" oldref="158">\</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147209" role="tablecontent" l10n="CHG" oldref="159">Search interprets the special character that follows the "\" as a normal character and not as a regular expression (except for the combinations \n, \t, \>, and \<). For example, "tree\." finds "tree.", not "treed" or "trees".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3152945" role="tablecontent" l10n="U" oldref="166">\n</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153700" role="tablecontent" l10n="CHG" oldref="167">Represents a line break that was inserted with the Shift+Enter key combination. To change a line break into a paragraph break, enter <emph>\n</emph> in the <emph>Search for</emph> and <emph>Replace with</emph> boxes, and then perform a search and replace.</paragraph>
<paragraph xml-lang="en-US" id="par_id9262672" role="tablecontent" l10n="NEW">\n in the <emph>Search for</emph> text box stands for a line break that was inserted with the Shift+Enter key combination.</paragraph>
<paragraph xml-lang="en-US" id="par_id2366100" role="tablecontent" l10n="NEW">\n in the <emph>Replace with</emph> text box stands for a paragraph break that can be entered with the Enter or Return key.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153258" role="tablecontent" l10n="U" oldref="29">\t</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3157809" role="tablecontent" l10n="CHG" oldref="30">Represents a tab. You can also use this expression in the <emph>Replace with</emph> box.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3146775" role="tablecontent" l10n="U" oldref="33">\></paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3148644" role="tablecontent" l10n="U" oldref="34">Only finds the search term if it appears at the end of a word. For example, "book\>" finds "checkbook", but not "bookmark".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150670" role="tablecontent" l10n="U" oldref="35">\<</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153666" role="tablecontent" l10n="CHG" oldref="36">Only finds the search term if it appears at the beginning of a word. For example, "\<book" finds "bookmark", but not "checkbook".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3149576" role="tablecontent" l10n="U" oldref="37">^$</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3151245" role="tablecontent" l10n="CHG" oldref="38">Finds an empty paragraph.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3148550" role="tablecontent" l10n="U" oldref="41">^.</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3159413" role="tablecontent" l10n="CHG" oldref="42">Finds the first character of a paragraph.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147282" role="tablecontent" l10n="CHG" oldref="43">& or $0</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153961" role="tablecontent" l10n="CHG" oldref="44">Adds the string that was found by the search criteria in the <emph>Search for</emph> box to the term in the <emph>Replace with</emph> box when you make a replacement.</paragraph>
<paragraph xml-lang="en-US" id="par_id3149650" role="tablecontent" l10n="CHG" oldref="201">For example, if you enter "window" in the <emph>Search for</emph> box and "&frame" in the <emph>Replace with</emph> box, the word "window" is replaced with "windowframe".</paragraph>
<paragraph xml-lang="en-US" id="par_id3150543" role="tablecontent" l10n="CHG" oldref="206">You can also enter an "&" in the <emph>Replace with</emph> box to modify the <emph>Attributes</emph> or the <emph>Format</emph> of the string found by the search criteria.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3145419" role="tablecontent" l10n="U" oldref="172">[abc123]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3154630" role="tablecontent" l10n="CHG" oldref="173">Represents one of the characters that are between the brackets.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3156293" role="tablecontent" l10n="U" oldref="174">[a-e]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3149167" role="tablecontent" l10n="CHG" oldref="175">Represents any of the characters that are between a and e, including both start and end characters</paragraph>
<paragraph xml-lang="en-US" id="par_id100520090232005" role="tablecontent" l10n="NEW">The characters are ordered by their code numbers.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3155994" role="tablecontent" l10n="U" oldref="176">[a-eh-x]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3148676" role="tablecontent" l10n="CHG" oldref="177">Represents any of the characters that are between a-e and h-x.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3145318" role="tablecontent" l10n="U" oldref="178">[^a-s]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153351" role="tablecontent" l10n="CHG" oldref="179">Represents everything that is not between a and s.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3156543" role="tablecontent" l10n="U" oldref="180">\xXXXX</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153768" role="tablecontent" l10n="U" oldref="181">Represents a special character based on its four-digit hexadecimal code (XXXX).</paragraph>
<paragraph xml-lang="en-US" id="par_id3159252" role="tablecontent" l10n="U" oldref="208">The code for the special character depends on the font used. You can view the codes by choosing <emph>Insert - Special Character</emph>.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153951" role="tablecontent" l10n="U" oldref="186">|</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3154985" role="tablecontent" l10n="CHG" oldref="187">Finds the terms that occur before the "|" and also finds the terms that occur after the "|". For example, "this|that" finds "this" and "that".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147376" role="tablecontent" l10n="U" oldref="209">{2}</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150103" role="tablecontent" l10n="U" oldref="210">Defines the number of times that the character in front of the opening bracket occurs. For example, "tre{2}" finds and selects "tree".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3151289" role="tablecontent" l10n="U" oldref="211">{1,2}</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147317" role="tablecontent" l10n="CHG" oldref="212">Defines the minimum and maximum number of times that the character in front of the opening bracket can occur. For example, "tre{1,2}" finds and selects "tre" and "tree".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id4870754" role="tablecontent" l10n="NEW">{1,}</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id843836" role="tablecontent" l10n="NEW">Defines the minimum number of times that the character in front of the opening bracket can occur. For example, "tre{2,}" finds "tree", "treee", and "treeeee".</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3148616" role="tablecontent" l10n="U" oldref="213">( )</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id2701803" role="tablecontent" l10n="NEW">In the <emph>Search for</emph> box:</paragraph>
<paragraph xml-lang="en-US" id="par_id3153573" role="tablecontent" l10n="CHG" oldref="214">Defines the characters inside the parentheses as a reference. You can then refer to the first reference in the current expression with "\1", to the second reference with "\2", and so on.</paragraph>
<paragraph xml-lang="en-US" id="par_id3156061" role="tablecontent" l10n="U" oldref="215">For example, if your text contains the number 13487889 and you search using the regular expression (8)7\1\1, "8788" is found.</paragraph>
<paragraph xml-lang="en-US" id="par_id2367931" role="tablecontent" l10n="NEW">You can also use () to group terms, for example, "a(bc)?d" finds "ad" or "abcd".</paragraph>
<paragraph xml-lang="en-US" id="par_id9200109" role="tablecontent" l10n="NEW">In the <emph>Replace with</emph> box:<comment>i83322</comment></paragraph>
<paragraph xml-lang="en-US" id="par_id5766472" role="tablecontent" l10n="NEW">Use $ (dollar) instead of \ (backslash) to replace references. Use $0 to replace the whole found string.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3154790" role="tablecontent" l10n="U" oldref="226">[:alpha:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3147397" role="tablecontent" l10n="CHG" oldref="227">Represents an alphabetic character. Use [:alpha:]+ to find one of them.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3152885" role="tablecontent" l10n="U" oldref="216">[:digit:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150010" role="tablecontent" l10n="CHG" oldref="217">Represents a decimal digit. Use [:digit:]+ to find one of them.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153743" role="tablecontent" l10n="U" oldref="224">[:alnum:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153281" role="tablecontent" l10n="CHG" oldref="225">Represents an alphanumeric character ([:alpha:] and [:digit:]).</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3153726" role="tablecontent" l10n="U" oldref="218">[:space:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150961" role="tablecontent" l10n="CHG" oldref="219">Represents a space character (but not other whitespace characters).<comment>UFI: see #i41706#</comment></paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150486" role="tablecontent" l10n="U" oldref="220">[:print:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150872" role="tablecontent" l10n="CHG" oldref="221">Represents a printable character.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3155854" role="tablecontent" l10n="U" oldref="222">[:cntrl:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3152576" role="tablecontent" l10n="CHG" oldref="223">Represents a nonprinting character.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3149958" role="tablecontent" l10n="U" oldref="228">[:lower:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3145730" role="tablecontent" l10n="CHG" oldref="229">Represents a lowercase character if <emph>Match case</emph> is selected in <emph>Options</emph>.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3148455" role="tablecontent" l10n="U" oldref="230">[:upper:]</paragraph>
</tablecell>
<tablecell>
<paragraph xml-lang="en-US" id="par_id3150092" role="tablecontent" l10n="CHG" oldref="231">Represents an uppercase character if <emph>Match case</emph> is selected in <emph>Options.</emph>
</paragraph>
</tablecell>
</tablerow>
</table>
<paragraph xml-lang="en-US" id="hd_id5311441" role="heading" level="2" l10n="NEW">Examples</paragraph>
<paragraph xml-lang="en-US" id="par_id9568773" role="paragraph" l10n="NEW">You can combine the search terms to form complex searches.</paragraph>
<paragraph xml-lang="en-US" id="hd_id71413" role="heading" level="3" l10n="NEW">To find three-digit numbers alone in a paragraph</paragraph>
<paragraph xml-lang="en-US" id="par_id2924283" role="code" l10n="NEW">^[:digit:]{3}$</paragraph>
<paragraph xml-lang="en-US" id="par_id5781731" role="paragraph" l10n="NEW">^ means the match has to be at the start of a paragraph, </paragraph>
<paragraph xml-lang="en-US" id="par_id6942045" role="paragraph" l10n="NEW">[:digit:] matches any decimal digit, </paragraph>
<paragraph xml-lang="en-US" id="par_id4721823" role="paragraph" l10n="NEW">{3} means there must be exactly 3 copies of "digit", </paragraph>
<paragraph xml-lang="en-US" id="par_id5806756" role="paragraph" l10n="NEW">$ means the match must end a paragraph. </paragraph>
<section id="relatedtopics">
<embed href="text/shared/01/02100000.xhp#02100000"/>
<switch select="appl">
<case select="WRITER"><embed href="text/swriter/guide/search_regexp.xhp#search_regexp"/>
<embed href="text/swriter/guide/finding.xhp#finding"/>
</case>
</switch>
<paragraph xml-lang="en-US" id="par_id1751457" role="paragraph" l10n="NEW"><link href="http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Regular_Expressions_in_Writer">Wiki page about regular expressions in Writer</link></paragraph>
<paragraph xml-lang="en-US" id="par_id5483870" role="paragraph" l10n="NEW"><link href="http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Regular_Expressions_in_Calc">Wiki page about regular expressions in Calc</link></paragraph>
</section>
</body>
</helpdocument>
|