@@ -368,6 +368,10 @@ msgid ""
368
368
"letters from the class ``[bcd]``, and finally ends with a ``'b'``. Now "
369
369
"imagine matching this RE against the string ``'abcbd'``."
370
370
msgstr ""
371
+ "一歩ずつ例を進めていくとより明確にわかります。\n"
372
+ "正規表現 ``a[bcd]*b`` を考えましょう。\n"
373
+ "この正規表現は文字 ``'a'`` 、文字クラス ``[bcd]`` の 0 個以上の文字、最後に来る ``'b'`` にマッチします。\n"
374
+ "この正規表現が文字列 ``'abcbd'`` に対してマッチする流れを想像してみましょう。"
371
375
372
376
#: ../../howto/regex.rst:189
373
377
msgid "Step"
@@ -391,7 +395,7 @@ msgstr "``a``"
391
395
392
396
#: ../../howto/regex.rst:191
393
397
msgid "The ``a`` in the RE matches."
394
- msgstr "``a`` が正規表現にマッチ 。"
398
+ msgstr "正規表現の ``a`` がマッチ 。"
395
399
396
400
#: ../../howto/regex.rst:193
397
401
msgid "2"
@@ -405,7 +409,7 @@ msgstr "``abcbd``"
405
409
msgid ""
406
410
"The engine matches ``[bcd]*``, going as far as it can, which is to the end "
407
411
"of the string."
408
- msgstr "正規表現エンジンが ``[bcd]*`` で文字列の最後まで可能な限り進む 。"
412
+ msgstr "正規表現エンジンが、文字列の終わりに向かってできるだけ遠くまで ``[bcd]*`` をマッチさせる 。"
409
413
410
414
#: ../../howto/regex.rst:197
411
415
msgid "3"
@@ -419,7 +423,7 @@ msgstr "*失敗*"
419
423
msgid ""
420
424
"The engine tries to match ``b``, but the current position is at the end of "
421
425
"the string, so it fails."
422
- msgstr "エンジンが ``b`` とのマッチを試みるが、現在の位置が文字列の最後なので、失敗する 。"
426
+ msgstr "正規表現エンジンが ``b`` でマッチを試みるが、現在の位置が文字列の最後なので失敗 。"
423
427
424
428
#: ../../howto/regex.rst:202
425
429
msgid "4"
@@ -431,7 +435,7 @@ msgstr "``abcb``"
431
435
432
436
#: ../../howto/regex.rst:202
433
437
msgid "Back up, so that ``[bcd]*`` matches one less character."
434
- msgstr "戻って ``[bcd]*`` は一文字少なくマッチ 。"
438
+ msgstr "``[bcd]*`` が一文字少なくマッチするように戻る 。"
435
439
436
440
#: ../../howto/regex.rst:205
437
441
msgid "5"
@@ -441,7 +445,7 @@ msgstr "5"
441
445
msgid ""
442
446
"Try ``b`` again, but the current position is at the last character, which is"
443
447
" a ``'d'``."
444
- msgstr "再び ``b`` へのマッチを試みるが、現在の文字は最後の文字 ``'d'`` 。"
448
+ msgstr "再び ``b`` にマッチするか試みるが、現在の位置は最後の文字 ``'d'`` 。"
445
449
446
450
#: ../../howto/regex.rst:209 ../../howto/regex.rst:213
447
451
msgid "6"
@@ -453,7 +457,7 @@ msgstr "``abc``"
453
457
454
458
#: ../../howto/regex.rst:209
455
459
msgid "Back up again, so that ``[bcd]*`` is only matching ``bc``."
456
- msgstr "再び戻る, ``[bcd]*`` は ``bc`` のみにマッチ 。"
460
+ msgstr "``[bcd]*`` は ``bc`` のみにマッチするように再び戻る 。"
457
461
458
462
#: ../../howto/regex.rst:213
459
463
msgid ""
@@ -470,6 +474,9 @@ msgid ""
470
474
" ``[bcd]*``, and if that subsequently fails, the engine will conclude that "
471
475
"the string doesn't match the RE at all."
472
476
msgstr ""
477
+ "正規表現の終端に達して、 ``'abcd'`` にマッチしました。\n"
478
+ "この説明は、マッチングエンジンが最初に到達できるところまで進みマッチしなかった場合、逐次戻って再度残りの正規表現とのマッチを次々と試みること様子を示しています。\n"
479
+ "正規表現エンジンは ``[bcd]*`` の 0 回マッチを試すところまで戻り、その後続の正規表現とのマッチに失敗した場合には、エンジンは正規表現と文字列が完全にマッチしないと結論づけることになります。"
473
480
474
481
#: ../../howto/regex.rst:226
475
482
msgid ""
@@ -480,6 +487,9 @@ msgid ""
480
487
"similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 "
481
488
"``'a'``\\ s), but won't match ``'ct'``."
482
489
msgstr ""
490
+ "別の繰り返しのメタ文字には ``+`` があり、この特殊文字は 1 回以上の繰り返しにマッチします。\n"
491
+ "``*`` と ``+`` に違いに対しては十分注意して下さい; ``*`` は *0 回* 以上の繰り返しにマッチするので、繰り返す部分が全くなくても問題ありません。一方で ``+`` は少なくとも *1 回* は表われる必要があります。\n"
492
+ "同様の例を使うと ``ca+t`` は ``'cat'`` (``'a'`` 1 文字)、 ``'caaat'`` (``'a'`` 3 文字)、とマッチし、``'ct'`` とはマッチしません。"
483
493
484
494
#: ../../howto/regex.rst:233
485
495
msgid ""
@@ -488,6 +498,9 @@ msgid ""
488
498
"something as being optional. For example, ``home-?brew`` matches either "
489
499
"``'homebrew'`` or ``'home-brew'``."
490
500
msgstr ""
501
+ "2回以上の繰り返しを制限する修飾子も存在します。\n"
502
+ "クエスチョンマーク ``?`` は0か1回のどちらかにマッチします; これはオプショナルな何かを示しているとも考えられます。\n"
503
+ "例えば、``home-?brew`` は ``'homebrew'`` と ``'home-brew'`` のどちらにもマッチします。"
491
504
492
505
#: ../../howto/regex.rst:238
493
506
msgid ""
@@ -497,13 +510,18 @@ msgid ""
497
510
"``'a/b'``, ``'a//b'``, and ``'a///b'``. It won't match ``'ab'``, which has "
498
511
"no slashes, or ``'a////b'``, which has four."
499
512
msgstr ""
513
+ "最も複雑な繰り返しの修飾子は ``{m,n}`` で、ここで *m* と *n* は 10 進整数です。\n"
514
+ "この修飾子は最低 *m* 回、最大で *n* 回の繰り返すことを意味しています。\n"
515
+ "例えば、 ``a/{1,3}b`` は ``'a/b'`` と ``'a//b'`` そして ``'a///b'`` にマッチし、スラッシュの無い ``'ab'`` や4つのスラッシュを持つ ``'a////b'`` にはマッチしません。"
500
516
501
517
#: ../../howto/regex.rst:244
502
518
msgid ""
503
519
"You can omit either *m* or *n*; in that case, a reasonable value is assumed "
504
520
"for the missing value. Omitting *m* is interpreted as a lower limit of 0, "
505
521
"while omitting *n* results in an upper bound of infinity."
506
522
msgstr ""
523
+ "*m* か *n* のどちらかは省略することができます; その場合は、省略された値は合理的な値が仮定されます。\n"
524
+ "*m* の省略は下限は 0 と解釈され、*n* の省略は上限は無限として解釈されます。"
507
525
508
526
#: ../../howto/regex.rst:248
509
527
msgid ""
@@ -513,9 +531,9 @@ msgid ""
513
531
"better to use ``*``, ``+``, or ``?`` when you can, simply because they're "
514
532
"shorter and easier to read."
515
533
msgstr ""
516
- "還元主義的素養のある読者は、3つの修飾子がこの表記で表現できることに気づくでしょう。 ``{0,}`` は ``*`` と同じで ``{1,}`` は "
517
- "``+ `` と、そして ``{0,1 }`` は ``? `` と同じです。利用できる場合には ``*``, ``+`` または ``?`` "
518
- "を利用した方が賢明です、そうすることで単純に、短く読み易くすることができます 。"
534
+ "還元主義者傾向のある読者は、3つの修飾子がこの表記を使って表現できることに気付くでしょう。\n "
535
+ "``{0,} `` は ``*`` と、 ``{1, }`` は ``+ `` と、そして ``{0,1}`` は ``?`` と同じです。\n "
536
+ "できるなら ``*``, ``+``, ``?`` を利用した方が賢明です。それは単に、短く読み易くなるからです 。"
519
537
520
538
#: ../../howto/regex.rst:256
521
539
msgid "Using Regular Expressions"
@@ -770,6 +788,8 @@ msgid ""
770
788
"objects>` instance is returned, containing information about the match: "
771
789
"where it starts and ends, the substring it matched, and more."
772
790
msgstr ""
791
+ ":meth:`~re.Pattern.match` と :meth:`~re.Pattern.search` はマッチするものが見つからなければ ``None`` を返します。\n"
792
+ "成功すればそれらは :ref:`Match オブジェクト <match-objects>` のインスタンスを返します。このオブジェクトにはマッチした情報が含まれます: マッチの開始と終了位置、マッチした部分文字列、など。"
773
793
774
794
#: ../../howto/regex.rst:380
775
795
msgid ""
@@ -801,6 +821,9 @@ msgid ""
801
821
" which will cause the interpreter to print no output. You can explicitly "
802
822
"print the result of :meth:`!match` to make this clear. ::"
803
823
msgstr ""
824
+ "さて、いろいろな文字列を使って正規表現 ``[a-z]+`` に対するマッチングを試してみましょう。空の文字列は全くマッチしません、なぜなら ``+``"
825
+ " は「1 回以上の繰り返し」を意味するからです。この場合では :meth:`~re.Pattern.match` は ``None`` "
826
+ "を返すべきで、インタプタは何も出力しません。明確にするために :meth:`!match` の結果を明示的に出力することもできます::"
804
827
805
828
#: ../../howto/regex.rst:405
806
829
msgid ""
@@ -809,13 +832,17 @@ msgid ""
809
832
"<match-objects>`, so you should store the result in a variable for later "
810
833
"use. ::"
811
834
msgstr ""
835
+ "では、今度はマッチするはずの文字列、例えば ``tempo`` を試してみましょう。このケースでは、 :meth:`~re.Pattern.match`"
836
+ " は :ref:`match object <match-objects>` を返すので、後で使うために結果を変数に記憶しておくべきです。 ::"
812
837
813
838
#: ../../howto/regex.rst:413
814
839
msgid ""
815
840
"Now you can query the :ref:`match object <match-objects>` for information "
816
841
"about the matching string. Match object instances also have several methods"
817
842
" and attributes; the most important ones are:"
818
843
msgstr ""
844
+ "これでマッチした文字列についての情報を :ref:`Match オブジェクト <match-objects>` に問い合わせることが出来ます。\n"
845
+ "Match オブジェクトインスタンスはいくつかのメソッドと属性も持っていて、最も重要なのは次のものです:"
819
846
820
847
#: ../../howto/regex.rst:420
821
848
msgid "``group()``"
@@ -864,6 +891,9 @@ msgid ""
864
891
"scans through the string, so the match may not start at zero in that case. "
865
892
"::"
866
893
msgstr ""
894
+ ":meth:`~re.Match.group` は正規表現でマッチした部分文字列を返します。 :meth:`~re.Match.start` と :meth:`~re.Match.end` はそれぞれ、マッチの開始インデクスと終了インデクスを返します。 :meth:`~re.Match.span` は開始と終了のインデクスを一つのタプルにして返します。\n"
895
+ ":meth:`~re.Pattern.match` メソッドは正規表現が文字列の開始位置でマッチするかどうかだけをチェックするので、 :meth:`!start` は必ずゼロを返します。\n"
896
+ "しかし、 :meth:`~re.Pattern.search` メソッドではパターンを文字列全体について走査するので、マッチの開始はゼロにならないかもしれません。 ::"
867
897
868
898
#: ../../howto/regex.rst:456
869
899
msgid ""
@@ -879,6 +909,8 @@ msgid ""
879
909
"Two pattern methods return all of the matches for a pattern. "
880
910
":meth:`~re.Pattern.findall` returns a list of matching strings::"
881
911
msgstr ""
912
+ "あるパターンにマッチするもの全てを返す Pattern インスタンスのメソッドが2つあります。\n"
913
+ ":meth:`~re.Pattern.findall` はマッチした文字列のリストを返します::"
882
914
883
915
#: ../../howto/regex.rst:474
884
916
msgid ""
0 commit comments