File: regex.3

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (313 lines) | stat: -rw-r--r-- 7,854 bytes parent folder | download
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
.\" Copyright (C), 1995, Graeme W. Wilford. (Wilf.)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Wed Jun 14 16:10:28 BST 1995 Wilf. (G.Wilford@ee.surrey.ac.uk)
.\" Tiny change in formatting - aeb, 950812
.\" Modified 8 May 1998 by Joseph S. Myers (jsm28@cam.ac.uk)
.\"
.\" Japanese Version Copyright (c) 1998 Takatsugu Nokubi
.\"	all rights reserved.
.\" Translated Tue Jun 30 20:24:07 JST 1998
.\"	by Takatsugu Nokubi
.\" Updated & Modified Mon Nov  5 12:35:34 JST 2001
.\"     by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified Thu Feb 24 04:46:05 JST 2005
.\"     by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.\"WORD:	bitwise-or		ӥåȤȤOR
.\"WORD:	element			(¤)
.\"WORD:	collating element	ȹ
.\"
.\" show the synopsis section nicely
.de xx
.in \\n(INu+\\$1
.ti -\\$1
..
.TH REGEX 3 1998-05-08 "GNU" "Linux Programmer's Manual"
.SH ̾
regcomp, regexec, regerror, regfree \- POSIX regex ؿ
.SH 
.nf
.B #include <sys/types.h>
.B #include <regex.h>

.BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );

.BI "int regexec(const regex_t *" preg ", const char *" string \
", size_t " nmatch ,
.BI "            regmatch_t " pmatch[] ", int " eflags );

.BI "size_t regerror(int " errcode ", const regex_t *" preg ", char *" errbuf ,
.BI "                size_t " errbuf_size );

.BI "void regfree(regex_t *" preg );
.fi
.SH 
.SS "POSIX regex ѥ"
.BR regcomp ()
ϡɽ򥳥ѥ뤷ơ
.BR regexec ()
ǤθŬ礹֤ˤ롣

.BR regcomp ()
ϥѥ򵭲ХåեؤΥݥ
.IR preg 
̥ʸǽü줿ʸ
.IR regex 
ƥѥη뤿Υե饰
.I cflag
ȼ

Ƥɽϡѥ뤵줿ѥˤäƹԤʤФʤʤ
äơ
.BR regexec ()
˻ꤹΤϡɬ
.RB ( regcomp ()
ˤäƥѥ뤵줿) ѥХåեؤΥɥ쥹ǤʤФʤʤ

.I cflags
ˤϰʲ˼İʾΥӥåȤȤ OR (bitwise-or) ꤹ롣
.TP
.B REG_EXTENDED
.I regex

.B POSIX
ĥɽѤ롣⤷Υե饰ꤵʤ硢
.B POSIX
ɸɽȤ롣
.TP
.B REG_ICASE
ʸʸΰ㤤̵뤹롣Υե饰ꤷƥѥ뤵줿
ѥХåեѤ
.BR regexec ()
ؿƤӽФȡʸʸζ̤դ˸Ԥ롣
.TP
.B REG_NOSUB
Υե饰ꤷƥѥ뤵줿ѥХåե
.BR regexec ()
ΰ˻ꤵȡѥ᡼
.IR nmatch ,
.I pmatch
̵뤵롣
.TP
.B REG_NEWLINE
Ƥʸ˥ޥå륪ڥ졼˲Ԥޥåʤ

Ԥޤޤʤޥåʸꥹ
.RB ( [^...] )
˲Ԥޥåʤ

.BR regexec ()
μ¹Ի˻ꤹե饰
.I eflags

.B REG_NOTBOL
ޤफɤˤ餺Ƭ˥ޥå륪ڥ졼
.RB ( ^ )
ľζʸ˥ޥå롣

.I eflags

.B REG_NOTEOL
ޤफɤˤ餺˥ޥå륪ڥ졼
.RB ( $ )
ľζʸ˥ޥå롣
.SS "POSIX regex ޥå"
.BR regexec ()
ϡ
ץꥳѥ뤵줿ѥХåե
.I preg
̥ʸǽü줿ʸ˥ޥå롣
.I nmatch

.I pmatch
ϥޥå󥰤ΰ֤˴ؤΤѤ롣
.I eflags
ˤ
.B REG_NOTBOL

.B REG_NOTEOL
Τɤ餫⤷ξΥӥåȤȤ
.BR OR " (bitwise-" or )
ꤷʲ褦˥ޥåưѲ롣
.TP
.B REG_NOTBOL
Ƭ˥ޥå륪ڥ졼ϡɬޥå˼Ԥ (ѥΥե饰
.B REG_NEWLINE
ιܤ⻲)
Υե饰ϡʣԤˤޤʸ
.BR regexec ()
ǸݤˡʸƬԤƬȤƲᤵʤѤ롣
.TP
.B REG_NOTEOL
˥ޥå륪ڥ졼ϡɬޥå˼Ԥ (ѥΥե饰
.B REG_NEWLINE
ιܤ⻲)
.SS Хȥեå
ѥХåեΥѥ
.B REG_NOSUB
ꤵʤϡʬʸΥޥå󥰰־뤳ȤǤ롣
.I pmatch
ϡʤȤ
.I nmatch
礭Ĥ褦˻ꤷʤФʤʤ
.BR regexec ()
μ¹Ԥˤäơʬʸޥå󥰰־롣
̤Ѥι¤Ǥˤ \-1 ͤȤ롣

.I pmatch
ηǤ
.I regmatch_t
¤Τϡ
.I <regex.h>

.in +4n
.nf
typedef struct {
    regoff_t rm_so;
    regoff_t rm_eo;
} regmatch_t;
.fi
.in

¤
.I rm_so
ͤ \-1 Ǥʤ硢ʸǤμκΥޥåʬγ
եåȰ֤򼨤Ф¤
.I rm_eo
ϥޥåʬνλեåȰ֤򼨤
.SS "POSIX 顼ݡ"
.BR regerror ()
ϡ
.BR regcomp ()

.BR regexec ()
μ¹Ԥˤä륨顼ɤ顢顼åʸ
ΤѤ롣

.BR regerror ()
ϥ顼
.IR errcode 
ѥХåե
.IR preg 
ʸХåեؤΥݥ
.IR errbuf 
ʸХåեΥ
.I errbuf_size
ˤȤ롣
δؿϡ̥ʸǽü줿顼åʸǼΤɬפ
.I errbuf
Υ֤⤷
.I errbuf

.I errbuf_size
ξ 0 ͤǤС
.I errbuf
ˤϺǽ
.I "errbuf_size \- 1"
ʸʬ˥顼åȽüΥ̥ʸޤ褦롣
.SS "POSIX ѥХåե"
˥ѥ뤵줿ѥХåե
.I preg
Ϳ
.BR regfree ()
ƤӽФȡ
.BR regcomp ()
ˤ륳ѥ˥ѥХåե˳Ƥ줿꤬롣
.SH ֤
.BR regcomp ()
ϡѥˤ 0 ֤Իˤϥ顼ɤ֤

.BR regexec ()
ϡޥå󥰤ˤ 0 ֤Իˤ
.B REG_NOMATCH
֤
.SH 顼
.BR regcomp ()
ϰʲΥ顼֤
.TP
.B REG_BADBR
̵ʸȥڥ졼λѡ
.TP
.B REG_BADPAT
롼פꥹȤʤɤΡѥ󥪥ڥ졼̵ʻѡ
.TP
.B REG_BADRPT
'*' ǽʸȤƤ褦ʡ̵ʷ֤ڥ졼λѡ
.TP
.B REG_EBRACE
󥿡Х륪ڥ졼
.B {}
(brace interval operators) ĤƤʤ
.TP
.B REG_EBRACK
ꥹȥڥ졼
.B []
(bracket list operators) ĤƤʤ
.TP
.B REG_ECOLLATE
ȹ (collating element) ȤͭǤϤʤ

() ȹ (collating element) ˤĤƤϡ
.BR regex (7)
򻲾ȡ
.TP
.B REG_ECTYPE
̤ΤΥ饯饹̾
.TP
.B REG_EEND
̤顼 POSIX.2 ˤƤʤ
.TP
.B REG_EESCAPE
ɽХååǽäƤ롣

() ܸĶξ硢ХååȤʤ٤꤬ߵ
ɽ뤳Ȥ뤬ñɽեȤǡ
ŪˤƱ̣Ǥ롣
.TP
.B REG_EPAREN
롼ץڥ졼
.B ()
(parenthesis group operators) ĤƤʤ
.TP
.B REG_ERANGE
̵ϰϥڥ졼λѡ
㤨СϰϤνλ֤ϰ֤ˤ褦ʾ硣
.TP
.B REG_ESIZE
ɽΥѥˡ64Kb ʾΥѥХåեɬס
 POSIX.2 ˤƤʤ
.TP
.B REG_ESPACE
regex 롼󤬥ȤϤƤ롣
.TP
.B REG_ESUBREG
֥ץå
.RB \e (...\e )
(subexpression) ؤ̵ʸȡ
.SH 
POSIX.1-2001.
.SH Ϣ
.BR grep (1),
.BR regex (7),
GNU regex ޥ˥奢