perlreref > 5.22.1 との差分

perlreref 5.22.1 と 5.26.1 の差分

11
22=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
88perlreref - Perl Regular Expressions Reference
99
1010=end original
1111
1212perlreref - Perl の正規表現のリファレンス
1313
1414=head1 DESCRIPTION
1515
1616=begin original
1717
1818This is a quick reference to Perl's regular expressions.
1919For full information see L<perlre> and L<perlop>, as well
2020as the L</"SEE ALSO"> section in this document.
2121
2222=end original
2323
2424本ドキュメントは、Perl の正規表現のクイックリファレンスです。
2525完全な情報は、L<perlre> と L<perlop>、また、本ドキュメントの
2626L</"SEE ALSO"> セクションを参照してください。
2727
2828=head2 OPERATORS
2929
3030(演算子)
3131
3232=begin original
3333
3434C<=~> determines to which variable the regex is applied.
3535In its absence, $_ is used.
3636
3737=end original
3838
3939C<=~> は正規表現が適用される変数を決定します。
4040省略された場合には、$_ が使われます。
4141
4242 $var =~ /foo/;
4343
4444=begin original
4545
4646C<!~> determines to which variable the regex is applied,
4747and negates the result of the match; it returns
4848false if the match succeeds, and true if it fails.
4949
5050=end original
5151
5252C<!~> は正規表現が適用される変数を決定し、マッチの結果を反転します;
5353マッチが成功すれば偽を返し、失敗すれば真を返します。
5454
5555 $var !~ /foo/;
5656
5757=begin original
5858
5959C<m/pattern/msixpogcdualn> searches a string for a pattern match,
6060applying the given options.
6161
6262=end original
6363
6464C<m/pattern/msixpogcdualn> パターンマッチのために文字列を検索し、
6565与えられたオプションを適用します。
6666
6767=begin original
6868
6969 m Multiline mode - ^ and $ match internal lines
7070 s match as a Single line - . matches \n
7171 i case-Insensitive
7272 x eXtended legibility - free whitespace and comments
7373 p Preserve a copy of the matched string -
7474 ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} will be defined.
7575 o compile pattern Once
7676 g Global - all occurrences
7777 c don't reset pos on failed matches when using /g
7878 a restrict \d, \s, \w and [:posix:] to match ASCII only
7979 aa (two a's) also /i matches exclude ASCII/non-ASCII
8080 l match according to current locale
8181 u match according to Unicode rules
8282 d match according to native rules unless something indicates
8383 Unicode
8484 n Non-capture mode. Don't let () fill in $1, $2, etc...
8585
8686=end original
8787
8888 m 複数行モード - ^ と $ が内部的な行にマッチします
8989 s 単行としてマッチ - . が \n にマッチします
9090 i 大小文字の違いを無視します
9191 x 読みやすさの拡張 - 空白やコメントを自由に置けます
9292 p マッチした文字列のコピーを保存する -
9393 ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} が定義されます。
9494 o パターンを一度だけコンパイルします
9595 g グローバル - マッチするものすべて
9696 c /g を使っているときにマッチに失敗しても pos をリセットしません
9797 a \d, \s, \w, [:posix:] で ASCII のみにマッチングするように制限
9898 aa (二つの a) また /i のマッチングは ASCII/非-ASCII を除外
9999 l 現在のロケールに従ってマッチング
100100 u Unicode のルールに従ってマッチング
101101 d Unicode を示すものがない限りネイティブなルールに従ってマッチング
102102 n 非捕捉モード。() で $1, $2 などを埋めない
103103
104104=begin original
105105
106106If 'pattern' is an empty string, the last I<successfully> matched
107107regex is used. Delimiters other than '/' may be used for both this
108108operator and the following ones. The leading C<m> can be omitted
109109if the delimiter is '/'.
110110
111111=end original
112112
113113'pattern' が空文字列なら、最後にマッチングに I<成功した>
114114正規表現が使われます。
115115この演算子とそれに続くものの両方で、'/' 以外のデリミタも使えます。
116116デリミタが '/' の場合は C<m> は省略できます。
117117
118118=begin original
119119
120120C<qr/pattern/msixpodualn> lets you store a regex in a variable,
121121or pass one around. Modifiers as for C<m//>, and are stored
122122within the regex.
123123
124124=end original
125125
126126C<qr/pattern/msixpodualn> は、正規表現を変数に入れるか、順に回せるように
127127します。
128128C<m//> と同じ修飾子が使えて、正規表現に保管されます。
129129
130130=begin original
131131
132132C<s/pattern/replacement/msixpogcedual> substitutes matches of
133133'pattern' with 'replacement'. Modifiers as for C<m//>,
134134with two additions:
135135
136136=end original
137137
138138C<s/pattern/replacement/msixpogcedual> は、'pattern' でマッチしたものを
139139'replacement' で置き換えます。
140140C<m//> と同じ修飾子が使えて、さらに二つ追加されます:
141141
142142=begin original
143143
144144 e Evaluate 'replacement' as an expression
145145 r Return substitution and leave the original string untouched.
146146
147147=end original
148148
149149 e 'replacement' を式として評価します
150150 r 置換した結果を返し、元の文字列は変更しません。
151151
152152=begin original
153153
154154'e' may be specified multiple times. 'replacement' is interpreted
155155as a double quoted string unless a single-quote (C<'>) is the delimiter.
156156
157157=end original
158158
159159'e' は複数回指定できます。
160160'replacement' は、デリミタとしてシングルクォート (C<'>) が使われた場合を
161161除いて、ダブルクォートされた文字列として解釈されます。
162162
163163=begin original
164164
165C<?pattern?> is like C<m/pattern/> but matches only once. No alternate
165C<m?pattern?> is like C<m/pattern/> but matches only once. No alternate
166166delimiters can be used. Must be reset with reset().
167167
168168=end original
169169
170C<?pattern?> は C<m/pattern/> に似ていますが、一度だけマッチします。
170C<m?pattern?> は C<m/pattern/> に似ていますが、一度だけマッチします。
171171デリミタは変更できません。
172172reset() でリセットしなければなりません。
173173
174174=head2 SYNTAX
175175
176176=begin original
177177
178178 \ Escapes the character immediately following it
179179 . Matches any single character except a newline (unless /s is
180180 used)
181181 ^ Matches at the beginning of the string (or line, if /m is used)
182182 $ Matches at the end of the string (or line, if /m is used)
183183 * Matches the preceding element 0 or more times
184184 + Matches the preceding element 1 or more times
185185 ? Matches the preceding element 0 or 1 times
186186 {...} Specifies a range of occurrences for the element preceding it
187187 [...] Matches any one of the characters contained within the brackets
188188 (...) Groups subexpressions for capturing to $1, $2...
189189 (?:...) Groups subexpressions without capturing (cluster)
190190 | Matches either the subexpression preceding or following it
191191 \g1 or \g{1}, \g2 ... Matches the text from the Nth group
192192 \1, \2, \3 ... Matches the text from the Nth group
193193 \g-1 or \g{-1}, \g-2 ... Matches the text from the Nth previous group
194194 \g{name} Named backreference
195195 \k<name> Named backreference
196196 \k'name' Named backreference
197197 (?P=name) Named backreference (python syntax)
198198
199199=end original
200200
201201 \ 直後の文字をエスケープします
202202 . 改行を除く任意の一文字にマッチします (/s が使われていない場合)
203203 ^ 文字列(/m が使われている場合は行)の先頭にマッチします
204204 $ 文字列(/m が使われている場合は行)の末尾にマッチします
205205 * 先行する要素のゼロ回以上の繰り返しにマッチします
206206 + 先行する要素の一回以上の繰り返しにマッチします
207207 ? 先行する要素のゼロ回または一回の出現にマッチします
208208 {...} 先行する要素の繰り返しの範囲を指定します
209209 [...] ブラケットの内側にある文字のいずれかにマッチします
210210 (...) $1, $2... のために部分正規表現をグループ化して捕捉します
211211 (?:...) 部分正規表現を捕捉することなくグループ化します (クラスター)
212212 | 左右いずれかにある部分正規表現にマッチします
213213 \g1 or \g{1}, \g2 ... N 番目のグループのテキストにマッチします
214214 \1, \2, \3 ... N 番目のグループのテキストにマッチします
215215 \g-1 or \g{-1}, \g-2 ... N 個前のグループのテキストにマッチします
216216 \g{name} 名前つき後方参照
217217 \k<name> 名前つき後方参照
218218 \k'name' 名前つき後方参照
219219 (?P=name) 名前つき後方参照 (python の文法)
220220
221221=head2 ESCAPE SEQUENCES
222222
223223(エスケープシーケンス)
224224
225225=begin original
226226
227227These work as in normal strings.
228228
229229=end original
230230
231231これらは通常の文字列として働きます。
232232
233233=begin original
234234
235235 \a Alarm (beep)
236236 \e Escape
237237 \f Formfeed
238238 \n Newline
239239 \r Carriage return
240240 \t Tab
241241 \037 Char whose ordinal is the 3 octal digits, max \777
242242 \o{2307} Char whose ordinal is the octal number, unrestricted
243243 \x7f Char whose ordinal is the 2 hex digits, max \xFF
244244 \x{263a} Char whose ordinal is the hex number, unrestricted
245245 \cx Control-x
246246 \N{name} A named Unicode character or character sequence
247247 \N{U+263D} A Unicode character by hex ordinal
248248
249249=end original
250250
251251 \a アラーム (ビープ)
252252 \e エスケープ
253253 \f 改ページ
254254 \n 改行
255255 \r キャリッジリターン
256256 \t タブ
257257 \037 番号が 3 桁の 8 進数である文字、最大 \777
258258 \o{2307} 番号が 8 進数である文字、無制限
259259 \x7f 番号が 2 桁の 16 進数である文字、最大 \xFF
260260 \x{263a} 番号が 16 進数である文字、無制限
261261 \cx Control-x
262262 \N{name} 名前つき Unicode 文字または文字並び
263263 \N{U+263D} 16 進数による Unicode 文字
264264
265265=begin original
266266
267267 \l Lowercase next character
268268 \u Titlecase next character
269269 \L Lowercase until \E
270270 \U Uppercase until \E
271271 \F Foldcase until \E
272272 \Q Disable pattern metacharacters until \E
273273 \E End modification
274274
275275=end original
276276
277277 \l 次の文字を小文字にします
278278 \u 次の文字をタイトル文字にします
279279 \L \E まで小文字にします
280280 \U \E まで大文字にします
281281 \F \E まで畳み込み文字にします
282282 \Q \E までパターンのメタ文字を無効にします
283283 \E 修正を終了します
284284
285285=begin original
286286
287287For Titlecase, see L</Titlecase>.
288288
289289=end original
290290
291291タイトル文字にについては L</Titlecase> を参照してください。
292292
293293=begin original
294294
295295This one works differently from normal strings:
296296
297297=end original
298298
299299この 1 つは通常の文字列とは異なった働きをします:
300300
301301=begin original
302302
303303 \b An assertion, not backspace, except in a character class
304304
305305=end original
306306
307307 \b 文字クラスの中以外では、表明であってバックスペースではありません
308308
309309=head2 CHARACTER CLASSES
310310
311311(文字クラス)
312312
313313=begin original
314314
315315 [amy] Match 'a', 'm' or 'y'
316316 [f-j] Dash specifies "range"
317317 [f-j-] Dash escaped or at start or end means 'dash'
318318 [^f-j] Caret indicates "match any character _except_ these"
319319
320320=end original
321321
322322 [amy] 'a', 'm', 'y' のいずれかにマッチ
323323 [f-j] ダッシュは「範囲」を指定します
324324 [f-j-] エスケープされるか、最初か最後にあるダッシュは「ダッシュ」を意味します
325325 [^f-j] キャレットは「これら以外にマッチ」を示します
326326
327327=begin original
328328
329329The following sequences (except C<\N>) work within or without a character class.
330330The first six are locale aware, all are Unicode aware. See L<perllocale>
331331and L<perlunicode> for details.
332332
333333=end original
334334
335335(C<\N> 以外の)以下のシーケンスは文字クラス内でもそれ以外でも動作します。
336336最初の 6 つはロケールの影響を受け、全ては Unicode の影響を受けます。
337337詳細については L<perllocale> と L<perlunicode> を参照してください。
338338
339339=begin original
340340
341341 \d A digit
342342 \D A nondigit
343343 \w A word character
344344 \W A non-word character
345345 \s A whitespace character
346346 \S A non-whitespace character
347347 \h An horizontal whitespace
348348 \H A non horizontal whitespace
349349 \N A non newline (when not followed by '{NAME}';;
350350 not valid in a character class; equivalent to [^\n]; it's
351351 like '.' without /s modifier)
352352 \v A vertical whitespace
353353 \V A non vertical whitespace
354354 \R A generic newline (?>\v|\x0D\x0A)
355355
356356=end original
357357
358358 \d 数値
359359 \D 非数値
360360 \w 単語文字
361361 \W 非単語文字
362362 \s 空白文字
363363 \S 非空白文字
364364 \h 水平空白文字
365365 \H 非水平空白文字
366366 \N 非改行 ('{NAME}' に引き続いていない場合;; 文字クラスでは
367367 不正; [^\n] と等価; /s なしの場合の '.' と同様)
368368 \v 垂直空白文字
369369 \V 非垂直空白文字
370370 \R 一般的な改行 (?>\v|\x0D\x0A)
371371
372372=begin original
373373
374 \C Match a byte (with Unicode, '.' matches a character)
375 (Deprecated.)
376374 \pP Match P-named (Unicode) property
377375 \p{...} Match Unicode property with name longer than 1 character
378376 \PP Match non-P
379377 \P{...} Match lack of Unicode property with name longer than 1 char
380378 \X Match Unicode extended grapheme cluster
381379
382380=end original
383381
384 \C 1 バイトにマッチする (Unicode では、'.' は文字にマッチする)
385 (廃止予定。)
386382 \pP P の名前の (Unicode) プロパティ
387383 \p{...} 1 文字より長い名前の Unicode プロパティにマッチする
388384 \PP 非 P にマッチする
389385 \P{...} 1 文字より長い名前の Unicode プロパティがないものにマッチする
390386 \X Unicode の拡張書記素クラスタにマッチする
391387
392388=begin original
393389
394390POSIX character classes and their Unicode and Perl equivalents:
395391
396392=end original
397393
398394POSIX 文字クラスと、それに対する Unicode と Perl の相当物は:
399395
400396 ASCII- Full-
401397 POSIX range range backslash
402398 [[:...:]] \p{...} \p{...} sequence Description
403399
404400=begin original
405401
406402 -----------------------------------------------------------------------
407 alnum PosixAlnum XPosixAlnum Alpha plus Digit
403 alnum PosixAlnum XPosixAlnum 'alpha' plus 'digit'
408404 alpha PosixAlpha XPosixAlpha Alphabetic characters
409405 ascii ASCII Any ASCII character
410406 blank PosixBlank XPosixBlank \h Horizontal whitespace;
411407 full-range also
412408 written as
413409 \p{HorizSpace} (GNU
414410 extension)
415411 cntrl PosixCntrl XPosixCntrl Control characters
416412 digit PosixDigit XPosixDigit \d Decimal digits
417 graph PosixGraph XPosixGraph Alnum plus Punct
413 graph PosixGraph XPosixGraph 'alnum' plus 'punct'
418414 lower PosixLower XPosixLower Lowercase characters
419 print PosixPrint XPosixPrint Graph plus Print, but
415 print PosixPrint XPosixPrint 'graph' plus 'space',
420 not any Cntrls
416 but not any Controls
421417 punct PosixPunct XPosixPunct Punctuation and Symbols
422418 in ASCII-range; just
423419 punct outside it
424 space PosixSpace XPosixSpace [\s\cK]
420 space PosixSpace XPosixSpace \s Whitespace
425 PerlSpace XPerlSpace \s Perl's whitespace def'n
426421 upper PosixUpper XPosixUpper Uppercase characters
427 word PosixWord XPosixWord \w Alnum + Unicode marks +
422 word PosixWord XPosixWord \w 'alnum' + Unicode marks
428 connectors, like '_'
423 + connectors, like
429 (Perl extension)
424 '_' (Perl extension)
430425 xdigit ASCII_Hex_Digit XPosixDigit Hexadecimal digit,
431426 ASCII-range is
432427 [0-9A-Fa-f]
433428
434429=end original
435430
436431 -----------------------------------------------------------------------
437 alnum PosixAlnum XPosixAlnum Alpha と Digit
432 alnum PosixAlnum XPosixAlnum 'alpha''digit'
438433 alpha PosixAlpha XPosixAlpha 英字
439434 ascii ASCII 任意の ASCII 文字
440435 blank PosixBlank XPosixBlank \h 水平空白;
441436 全種類は \p{HorizSpace}
442437 とも (GNU 拡張)
443438 cntrl PosixCntrl XPosixCntrl 制御文字
444439 digit PosixDigit XPosixDigit \d 数字
445 graph PosixGraph XPosixGraph Alnum と Punct
440 graph PosixGraph XPosixGraph 'alnum''punct'
446441 lower PosixLower XPosixLower 小文字
447 print PosixPrint XPosixPrint Graph と Print、しかし
442 print PosixPrint XPosixPrint 'graph''space', しかし
448 Cntrl は含まない
443 Control は含まない
449444 punct PosixPunct XPosixPunct ASCII の範囲の句読点と
450445 シンボル; 単にその外側の
451446 punct
452 space PosixSpace XPosixSpace [\s\cK]
447 space PosixSpace XPosixSpace \s 空白文字
453 PerlSpace XPerlSpace \s Perl の空白の定義
454448 upper PosixUpper XPosixUpper 大文字
455 word PosixWord XPosixWord \w Alnum + Unicode マーク +
449 word PosixWord XPosixWord \w 'alnum' + Unicode マーク +
456450 '_' のような接続文字
457451 (Perl 拡張)
458452 xdigit ASCII_Hex_Digit XPosixDigit 16 進数;
459453 ASCII の範囲では
460454 [0-9A-Fa-f]
461455
462456=begin original
463457
464458Also, various synonyms like C<\p{Alpha}> for C<\p{XPosixAlpha}>; all listed
465459in L<perluniprops/Properties accessible through \p{} and \P{}>
466460
467461=end original
468462
469463また、C<\p{XPosixAlpha}> のための C<\p{Alpha}> のような、さまざまな
470464同義語があります; 全ての一覧は
471465L<perluniprops/Properties accessible through \p{} and \P{}> にあります。
472466
473467=begin original
474468
475469Within a character class:
476470
477471=end original
478472
479473文字クラスの中では:
480474
481475 POSIX traditional Unicode
482476 [:digit:] \d \p{Digit}
483477 [:^digit:] \D \P{Digit}
484478
485479=head2 ANCHORS
486480
487481(アンカー)
488482
489483=begin original
490484
491485All are zero-width assertions.
492486
493487=end original
494488
495489すべてゼロ幅の表明です。
496490
497491=begin original
498492
499493 ^ Match string start (or line, if /m is used)
500494 $ Match string end (or line, if /m is used) or before newline
501495 \b{} Match boundary of type specified within the braces
502496 \B{} Match wherever \b{} doesn't match
503497 \b Match word boundary (between \w and \W)
504498 \B Match except at word boundary (between \w and \w or \W and \W)
505499 \A Match string start (regardless of /m)
506500 \Z Match string end (before optional newline)
507501 \z Match absolute string end
508502 \G Match where previous m//g left off
509503 \K Keep the stuff left of the \K, don't include it in $&
510504
511505=end original
512506
513507 ^ 文字列(/m が指定されている場合には行)の先頭にマッチします
514508 $ 文字列(/m が指定されている場合には行)の終端もしくは改行の前にマッチします
515509 \b{} 中かっこ内で指定された境界にマッチングする
516510 \B{} \b{} でマッチングしないものにマッチングする
517511 \b 単語境界(\w と ¥W の間)にマッチします
518512 \B 単語境界以外(\w と \w の間か \W と \W の間)にマッチします
519513 \A 文字列の先頭(/m には影響されません)にマッチします
520514 \Z 文字列の末尾(省略可能な改行の前)にマッチします
521515 \z 文字列の本当の末尾にマッチします
522516 \G 前回の m//g のマッチした場所の末尾にマッチします
523517 \K \K の左側の内容を維持する、$& には含まない
524518
525519=head2 QUANTIFIERS
526520
527521(量指定子)
528522
529523=begin original
530524
531525Quantifiers are greedy by default and match the B<longest> leftmost.
532526
533527=end original
534528
535529量指定子はデフォルトでは貪欲で、 一番左から B<一番長く> マッチします。
536530
537531=begin original
538532
539533 Maximal Minimal Possessive Allowed range
540534 ------- ------- ---------- -------------
541535 {n,m} {n,m}? {n,m}+ Must occur at least n times
542536 but no more than m times
543537 {n,} {n,}? {n,}+ Must occur at least n times
544538 {n} {n}? {n}+ Must occur exactly n times
545539 * *? *+ 0 or more times (same as {0,})
546540 + +? ++ 1 or more times (same as {1,})
547541 ? ?? ?+ 0 or 1 time (same as {0,1})
548542
549543=end original
550544
551545 最大 最小 所有格 範囲
552546 ------- ------- ---------- -------------
553547 {n,m} {n,m}? {n,m}+ 最低 n 回、m 回以内出現
554548 {n,} {n,}? {n,}+ 最低 n 回出現
555549 {n} {n}? {n}+ 正確に n 回出現
556550 * *? *+ 0 回以上 ({0,} と同じ)
557551 + +? ++ 1 回以上 ({1,} と同じ)
558552 ? ?? ?+ 0 回または 1 回 ({0,1} と同じ)
559553
560554=begin original
561555
562556The possessive forms (new in Perl 5.10) prevent backtracking: what gets
563557matched by a pattern with a possessive quantifier will not be backtracked
564558into, even if that causes the whole match to fail.
565559
566560=end original
567561
568562(Perl 5.10 で導入された) 所有格はバックトラックを抑制します:
569563所有格量指定子が付いたパターンでマッチした場合、バックトラックはしません;
570564たとえこれによってマッチ全体が失敗することになってもです。
571565
572566=begin original
573567
574568There is no quantifier C<{,n}>. That's interpreted as a literal string.
575569
576570=end original
577571
578572C<{,n}> という量指定子はありません。
579573これはリテラルな文字列として扱われます。
580574
581575=head2 EXTENDED CONSTRUCTS
582576
583577(拡張構造)
584578
585579=begin original
586580
587581 (?#text) A comment
588582 (?:...) Groups subexpressions without capturing (cluster)
589583 (?pimsx-imsx:...) Enable/disable option (as per m// modifiers)
590584 (?=...) Zero-width positive lookahead assertion
591585 (?!...) Zero-width negative lookahead assertion
592586 (?<=...) Zero-width positive lookbehind assertion
593587 (?<!...) Zero-width negative lookbehind assertion
594588 (?>...) Grab what we can, prohibit backtracking
595589 (?|...) Branch reset
596590 (?<name>...) Named capture
597591 (?'name'...) Named capture
598592 (?P<name>...) Named capture (python syntax)
599593 (?[...]) Extended bracketed character class
600594 (?{ code }) Embedded code, return value becomes $^R
601595 (??{ code }) Dynamic regex, return value used as regex
602596 (?N) Recurse into subpattern number N
603597 (?-N), (?+N) Recurse into Nth previous/next subpattern
604598 (?R), (?0) Recurse at the beginning of the whole pattern
605599 (?&name) Recurse into a named subpattern
606600 (?P>name) Recurse into a named subpattern (python syntax)
607601 (?(cond)yes|no)
608602 (?(cond)yes) Conditional expression, where "cond" can be:
609 (?=pat) look-ahead
603 (?=pat) lookahead
610 (?!pat) negative look-ahead
604 (?!pat) negative lookahead
611 (?<=pat) look-behind
605 (?<=pat) lookbehind
612 (?<!pat) negative look-behind
606 (?<!pat) negative lookbehind
613607 (N) subpattern N has matched something
614608 (<name>) named subpattern has matched something
615609 ('name') named subpattern has matched something
616610 (?{code}) code condition
617611 (R) true if recursing
618612 (RN) true if recursing into Nth subpattern
619613 (R&name) true if recursing into named subpattern
620614 (DEFINE) always false, no no-pattern allowed
621615
622616=end original
623617
624618 (?#text) コメント
625619 (?:...) 部分正規表現を捕捉することなくグループ化します (クラスター)
626620 (?imxs-imsx:...) オプションを有効/無効にする (m// 修飾子のものと同じ)
627621 (?=...) ゼロ幅の肯定先読み表明
628622 (?!...) ゼロ幅の否定先読み表明
629623 (?<=...) ゼロ幅の肯定後読み表明
630624 (?<!...) ゼロ幅の否定後読み表明
631625 (?>...) 出来うる限りマッチし、バックトラックしない
632626 (?|...) 分岐のリセット
633627 (?<name>...) 名前付き捕捉
634628 (?'name'...) 名前付き捕捉
635629 (?P<name>...) 名前付き捕捉 (python 文法)
636630 (?[...]) 拡張大かっこ文字クラス
637631 (?{ code }) 埋め込みコード。 戻り値は $^R に格納されます
638632 (??{ code }) 動的正規表現。戻り値は正規表現として扱われます
639633 (?N) サブパターン番号 N に再帰する
640634 (?-N), (?+N) N 個前/後のサブパターンに再帰する
641635 (?R), (?0) パターン全体の先頭に再帰する
642636 (?&name) 名前付きサブパターンに再帰する
643637 (?P>name) 名前付きサブパターンに再帰する (python 文法)
644638 (?(cond)yes|no)
645639 (?(cond)yes) 条件式; "cond" で指定できるのは:
646640 (?=pat) 前方参照
647641 (?!pat) 前方参照の否定
648642 (?<=pat) 後方参照
649643 (?<!pat) 後方参照の否定
650644 (N) サブパターン N が何かにマッチした
651645 (<name>) 名前付きサブルーチンが何かにマッチした
652646 ('name') 名前付きサブルーチンが何かにマッチした
653647 (?{code}) コード条件
654648 (R) 再帰したら真
655649 (RN) N 番目のサブパターンに再帰したら真
656650 (R&name) 名前付きサブパターンに再帰したら真
657651 (DEFINE) 常に偽; パターンなしは許されない
658652
659653=head2 VARIABLES
660654
661655(変数)
662656
663657=begin original
664658
665659 $_ Default variable for operators to use
666660
667661=end original
668662
669663 $_ 演算子が使用するデフォルトの変数
670664
671665=begin original
672666
673667 $` Everything prior to matched string
674668 $& Entire matched string
675669 $' Everything after to matched string
676670
677671=end original
678672
679673 $` マッチした文字列に先行する部分
680674 $& マッチした文字列全体
681675 $' マッチした文字列に後続する部分
682676
683677=begin original
684678
685679 ${^PREMATCH} Everything prior to matched string
686680 ${^MATCH} Entire matched string
687681 ${^POSTMATCH} Everything after to matched string
688682
689683=end original
690684
691685 ${^PREMATCH} マッチした文字列に先行する部分
692686 ${^MATCH} マッチした文字列全体
693687 ${^POSTMATCH} マッチした文字列に後続する部分
694688
695689=begin original
696690
697691Note to those still using Perl 5.18 or earlier:
698692The use of C<$`>, C<$&> or C<$'> will slow down B<all> regex use
699693within your program. Consult L<perlvar> for C<@->
700694to see equivalent expressions that won't cause slow down.
701695See also L<Devel::SawAmpersand>. Starting with Perl 5.10, you
702696can also use the equivalent variables C<${^PREMATCH}>, C<${^MATCH}>
703697and C<${^POSTMATCH}>, but for them to be defined, you have to
704698specify the C</p> (preserve) modifier on your regular expression.
705699In Perl 5.20, the use of C<$`>, C<$&> and C<$'> makes no speed difference.
706700
707701=end original
708702
709703まだ Perl 5.18 以前を使っている場合の注意:
710704C<$`>, C<$&>, C<$'> のいずれかを使うと、プログラム中の B<全ての> 正規表現の
711705速度が低下します。
712706速度低下を引き起こさない、等価な表現のためには、L<perlvar> の C<@-> を
713707調べてみてください。
714708また、L<Devel::SawAmpersand> も参照してください。
715709Perl 5.10 から、等価な変数である C<${^PREMATCH}>, C<${^MATCH}>,
716710C<${^POSTMATCH}> も使えますが、これらが定義されるには、正規表現に
717711C</p> (保存(preserve)) 修飾子をつける必要があります。
718712Perl 5.20 では、C<$`>, C<$&>, C<$'> を使っても速度の違いはありません。
719713
720714=begin original
721715
722716 $1, $2 ... hold the Xth captured expr
723717 $+ Last parenthesized pattern match
724718 $^N Holds the most recently closed capture
725719 $^R Holds the result of the last (?{...}) expr
726720 @- Offsets of starts of groups. $-[0] holds start of whole match
727721 @+ Offsets of ends of groups. $+[0] holds end of whole match
728722 %+ Named capture groups
729723 %- Named capture groups, as array refs
730724
731725=end original
732726
733727 $1, $2 ... X 番目の捕捉された式を保持します
734728 $+ 最後にかっこで囲まれたパターンマッチ
735729 $^N 最も近くに閉じた捕捉を保持します
736730 $^R 最後の (?{...}) 式の結果を保持します
737731 @- グループの先頭からのオフセット。 $-[0] はマッチ全体の先頭です
738732 @+ グループの末尾からのオフセット。 $+[0] はマッチ全体の末尾です
739733 %+ 名前付き捕捉グループ
740734 %- 配列リファレンスとしての名前付き捕捉グループ
741735
742736=begin original
743737
744738Captured groups are numbered according to their I<opening> paren.
745739
746740=end original
747741
748742捕捉したグループは I<開き> かっこの順番で番号付けされます。
749743
750744=head2 FUNCTIONS
751745
752746(関数)
753747
754748=begin original
755749
756750 lc Lowercase a string
757751 lcfirst Lowercase first char of a string
758752 uc Uppercase a string
759753 ucfirst Titlecase first char of a string
760754 fc Foldcase a string
761755
762756=end original
763757
764758 lc 文字列を小文字にします
765759 lcfirst 文字列の最初の文字を小文字にします
766760 uc 文字列を大文字にします
767761 ucfirst 文字列の最初の文字を Titlecase にします
768762 fc 文字列を畳み込み文字にします
769763
770764=begin original
771765
772766 pos Return or set current match position
773767 quotemeta Quote metacharacters
774 reset Reset ?pattern? status
768 reset Reset m?pattern? status
775769 study Analyze string for optimizing matching
776770
777771=end original
778772
779773 pos カレントのマッチ位置を返したり設定したりします
780774 quotemeta メタ文字をクォートします
781 reset ?pattern? の状態をリセットします
775 reset m?pattern? の状態をリセットします
782776 study マッチングの最適化のために文字列を調べます
783777
784778=begin original
785779
786780 split Use a regex to split a string into parts
787781
788782=end original
789783
790784 split 文字列を分割するために正規表現を使います
791785
792786=begin original
793787
794788The first five of these are like the escape sequences C<\L>, C<\l>,
795789C<\U>, C<\u>, and C<\F>. For Titlecase, see L</Titlecase>; For
796790Foldcase, see L</Foldcase>.
797791
798792=end original
799793
800794これらの最初の五つは、エスケープシーケンス C<\L>, C<\l>, C<\U>, C<\u>,
801795C<\F> と似ています。
802796タイトル文字については、L</Titlecase> を参照してください;
803797畳み込み文字については、L</Foldcase> を参照してください。
804798
805799=head2 TERMINOLOGY
806800
807801(用語)
808802
809803=head3 Titlecase
810804
811805(タイトル文字)
812806
813807=begin original
814808
815809Unicode concept which most often is equal to uppercase, but for
816810certain characters like the German "sharp s" there is a difference.
817811
818812=end original
819813
820814Unicode の概念で、ほとんどの場合は大文字と同じですが、ドイツ語の
821815"sharp s" のような特定の文字については異なります。
822816
823817=head3 Foldcase
824818
825819(畳み込み文字)
826820
827821=begin original
828822
829823Unicode form that is useful when comparing strings regardless of case,
830824as certain characters have complex one-to-many case mappings. Primarily a
831825variant of lowercase.
832826
833827=end original
834828
835829大文字小文字に関わらず文字列を比較するときに有用な Unicode の形式です;
836830ある種の文字は複雑な 1 対多大文字小文字マッピングを持つからです。
837831主に小文字の変種です。
838832
839833=head1 AUTHOR
840834
841835Iain Truskett. Updated by the Perl 5 Porters.
842836
843837This document may be distributed under the same terms as Perl itself.
844838
845839=head1 SEE ALSO
846840
847841=over 4
848842
849843=item *
850844
851845=begin original
852846
853847L<perlretut> for a tutorial on regular expressions.
854848
855849=end original
856850
857851正規表現のチュートリアルである L<perlretut>。
858852
859853=item *
860854
861855=begin original
862856
863857L<perlrequick> for a rapid tutorial.
864858
865859=end original
866860
867861手っ取り早いチュートリアルである L<perlrequick>。
868862
869863=item *
870864
871865=begin original
872866
873867L<perlre> for more details.
874868
875869=end original
876870
877871さらなる詳細である L<perlre>。
878872
879873=item *
880874
881875=begin original
882876
883877L<perlvar> for details on the variables.
884878
885879=end original
886880
887881変数に関する詳細である L<perlvar>。
888882
889883=item *
890884
891885=begin original
892886
893887L<perlop> for details on the operators.
894888
895889=end original
896890
897891演算子の詳細である L<perlop>。
898892
899893=item *
900894
901895=begin original
902896
903897L<perlfunc> for details on the functions.
904898
905899=end original
906900
907901関数の詳細である L<perlfunc>。
908902
909903=item *
910904
911905=begin original
912906
913907L<perlfaq6> for FAQs on regular expressions.
914908
915909=end original
916910
917911正規表現に関する FAQ である L<perlfaq6>。
918912
919913=item *
920914
921915=begin original
922916
923917L<perlrebackslash> for a reference on backslash sequences.
924918
925919=end original
926920
927921バックスラッシュシーケンス の参考資料である L<perlrebackslash>。
928922
929923=item *
930924
931925=begin original
932926
933927L<perlrecharclass> for a reference on character classes.
934928
935929=end original
936930
937931文字クラスの参考資料である L<perlrecharclass>。
938932
939933=item *
940934
941935=begin original
942936
943937The L<re> module to alter behaviour and aid
944938debugging.
945939
946940=end original
947941
948942振る舞いの変更とデバッグの補助のための L<re> モジュール。
949943
950944=item *
951945
952946L<perldebug/"Debugging Regular Expressions">
953947
954948=item *
955949
956950=begin original
957951
958952L<perluniintro>, L<perlunicode>, L<charnames> and L<perllocale>
959953for details on regexes and internationalisation.
960954
961955=end original
962956
963957正規表現や国際化に関する詳細である L<perluniintro>, L<perlunicode>,
964958L<charnames>, L<perllocale>。
965959
966960=item *
967961
968962=begin original
969963
970964I<Mastering Regular Expressions> by Jeffrey Friedl
971(F<http://oreilly.com/catalog/9780596528126/>) for a thorough grounding and
965(L<http://oreilly.com/catalog/9780596528126/>) for a thorough grounding and
972966reference on the topic.
973967
974968=end original
975969
976970この話題に関する完全な背景と参考資料である
977971Jeffrey Friedl による書籍 I<Mastering Regular Expressions>
978(F<http://oreilly.com/catalog/9780596528126/>)
972(L<http://oreilly.com/catalog/9780596528126/>)
979973(O'Reillyから出版: ISBN 1556592-257-3)
980974(日本語版は「詳説 正規表現」ISBN4-87311-130-7 (第二版のもの))。
981975
982976=back
983977
984978=head1 THANKS
985979
986980David P.C. Wollmann,
987981Richard Soderberg,
988982Sean M. Burke,
989983Tom Christiansen,
990984Jim Cromie,
991985and
992986Jeffrey Goff
993987for useful advice.
994988
995989=cut
996990
997991=begin meta
998992
999993Translate: KIMURA Koichi
1000994Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.10.0-)
1001995Status: completed
1002996
1003997=end meta