@@ -368,6 +368,10 @@ msgid ""
368368"letters from the class ``[bcd]``, and finally ends with a ``'b'``. Now "
369369"imagine matching this RE against the string ``'abcbd'``."
370370msgstr ""
371+ "一歩ずつ例を進めていくとより明確にわかります。\n"
372+ "正規表現 ``a[bcd]*b`` を考えましょう。\n"
373+ "この正規表現は文字 ``'a'`` 、文字クラス ``[bcd]`` の 0 個以上の文字、最後に来る ``'b'`` にマッチします。\n"
374+ "この正規表現が文字列 ``'abcbd'`` に対してマッチする流れを想像してみましょう。"
371375
372376#: ../../howto/regex.rst:189
373377msgid "Step"
@@ -391,7 +395,7 @@ msgstr "``a``"
391395
392396#: ../../howto/regex.rst:191
393397msgid "The ``a`` in the RE matches."
394- msgstr "``a`` が正規表現にマッチ 。"
398+ msgstr "正規表現の ``a`` がマッチ 。"
395399
396400#: ../../howto/regex.rst:193
397401msgid "2"
@@ -405,7 +409,7 @@ msgstr "``abcbd``"
405409msgid ""
406410"The engine matches ``[bcd]*``, going as far as it can, which is to the end "
407411"of the string."
408- msgstr "正規表現エンジンが ``[bcd]*`` で文字列の最後まで可能な限り進む 。"
412+ msgstr "正規表現エンジンが、文字列の終わりに向かってできるだけ遠くまで ``[bcd]*`` をマッチさせる 。"
409413
410414#: ../../howto/regex.rst:197
411415msgid "3"
@@ -419,7 +423,7 @@ msgstr "*失敗*"
419423msgid ""
420424"The engine tries to match ``b``, but the current position is at the end of "
421425"the string, so it fails."
422- msgstr "エンジンが ``b`` とのマッチを試みるが、現在の位置が文字列の最後なので、失敗する 。"
426+ msgstr "正規表現エンジンが ``b`` でマッチを試みるが、現在の位置が文字列の最後なので失敗 。"
423427
424428#: ../../howto/regex.rst:202
425429msgid "4"
@@ -431,7 +435,7 @@ msgstr "``abcb``"
431435
432436#: ../../howto/regex.rst:202
433437msgid "Back up, so that ``[bcd]*`` matches one less character."
434- msgstr "戻って ``[bcd]*`` は一文字少なくマッチ 。"
438+ msgstr "``[bcd]*`` が一文字少なくマッチするように戻る 。"
435439
436440#: ../../howto/regex.rst:205
437441msgid "5"
@@ -441,7 +445,7 @@ msgstr "5"
441445msgid ""
442446"Try ``b`` again, but the current position is at the last character, which is"
443447" a ``'d'``."
444- msgstr "再び ``b`` へのマッチを試みるが、現在の文字は最後の文字 ``'d'`` 。"
448+ msgstr "再び ``b`` にマッチするか試みるが、現在の位置は最後の文字 ``'d'`` 。"
445449
446450#: ../../howto/regex.rst:209 ../../howto/regex.rst:213
447451msgid "6"
@@ -453,7 +457,7 @@ msgstr "``abc``"
453457
454458#: ../../howto/regex.rst:209
455459msgid "Back up again, so that ``[bcd]*`` is only matching ``bc``."
456- msgstr "再び戻る, ``[bcd]*`` は ``bc`` のみにマッチ 。"
460+ msgstr "``[bcd]*`` は ``bc`` のみにマッチするように再び戻る 。"
457461
458462#: ../../howto/regex.rst:213
459463msgid ""
@@ -470,6 +474,9 @@ msgid ""
470474" ``[bcd]*``, and if that subsequently fails, the engine will conclude that "
471475"the string doesn't match the RE at all."
472476msgstr ""
477+ "正規表現の終端に達して、 ``'abcd'`` にマッチしました。\n"
478+ "この説明は、マッチングエンジンが最初に到達できるところまで進みマッチしなかった場合、逐次戻って再度残りの正規表現とのマッチを次々と試みること様子を示しています。\n"
479+ "正規表現エンジンは ``[bcd]*`` の 0 回マッチを試すところまで戻り、その後続の正規表現とのマッチに失敗した場合には、エンジンは正規表現と文字列が完全にマッチしないと結論づけることになります。"
473480
474481#: ../../howto/regex.rst:226
475482msgid ""
@@ -480,6 +487,9 @@ msgid ""
480487"similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 "
481488"``'a'``\\ s), but won't match ``'ct'``."
482489msgstr ""
490+ "別の繰り返しのメタ文字には ``+`` があり、この特殊文字は 1 回以上の繰り返しにマッチします。\n"
491+ "``*`` と ``+`` に違いに対しては十分注意して下さい; ``*`` は *0 回* 以上の繰り返しにマッチするので、繰り返す部分が全くなくても問題ありません。一方で ``+`` は少なくとも *1 回* は表われる必要があります。\n"
492+ "同様の例を使うと ``ca+t`` は ``'cat'`` (``'a'`` 1 文字)、 ``'caaat'`` (``'a'`` 3 文字)、とマッチし、``'ct'`` とはマッチしません。"
483493
484494#: ../../howto/regex.rst:233
485495msgid ""
@@ -488,6 +498,9 @@ msgid ""
488498"something as being optional. For example, ``home-?brew`` matches either "
489499"``'homebrew'`` or ``'home-brew'``."
490500msgstr ""
501+ "2回以上の繰り返しを制限する修飾子も存在します。\n"
502+ "クエスチョンマーク ``?`` は0か1回のどちらかにマッチします; これはオプショナルな何かを示しているとも考えられます。\n"
503+ "例えば、``home-?brew`` は ``'homebrew'`` と ``'home-brew'`` のどちらにもマッチします。"
491504
492505#: ../../howto/regex.rst:238
493506msgid ""
@@ -497,13 +510,18 @@ msgid ""
497510"``'a/b'``, ``'a//b'``, and ``'a///b'``. It won't match ``'ab'``, which has "
498511"no slashes, or ``'a////b'``, which has four."
499512msgstr ""
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'`` にはマッチしません。"
500516
501517#: ../../howto/regex.rst:244
502518msgid ""
503519"You can omit either *m* or *n*; in that case, a reasonable value is assumed "
504520"for the missing value. Omitting *m* is interpreted as a lower limit of 0, "
505521"while omitting *n* results in an upper bound of infinity."
506522msgstr ""
523+ "*m* か *n* のどちらかは省略することができます; その場合は、省略された値は合理的な値が仮定されます。\n"
524+ "*m* の省略は下限は 0 と解釈され、*n* の省略は上限は無限として解釈されます。"
507525
508526#: ../../howto/regex.rst:248
509527msgid ""
@@ -513,9 +531,9 @@ msgid ""
513531"better to use ``*``, ``+``, or ``?`` when you can, simply because they're "
514532"shorter and easier to read."
515533msgstr ""
516- "還元主義的素養のある読者は、3つの修飾子がこの表記で表現できることに気づくでしょう。 ``{0,}`` は ``*`` と同じで ``{1,}`` は "
517- "``+ `` と、そして ``{0,1 }`` は ``? `` と同じです。利用できる場合には ``*``, ``+`` または ``?`` "
518- "を利用した方が賢明です、そうすることで単純に、短く読み易くすることができます 。"
534+ "還元主義者傾向のある読者は、3つの修飾子がこの表記を使って表現できることに気付くでしょう。\n "
535+ "``{0,} `` は ``*`` と、 ``{1, }`` は ``+ `` と、そして ``{0,1}`` は ``?`` と同じです。\n "
536+ "できるなら ``*``, ``+``, ``?`` を利用した方が賢明です。それは単に、短く読み易くなるからです 。"
519537
520538#: ../../howto/regex.rst:256
521539msgid "Using Regular Expressions"
@@ -770,6 +788,8 @@ msgid ""
770788"objects>` instance is returned, containing information about the match: "
771789"where it starts and ends, the substring it matched, and more."
772790msgstr ""
791+ ":meth:`~re.Pattern.match` と :meth:`~re.Pattern.search` はマッチするものが見つからなければ ``None`` を返します。\n"
792+ "成功すればそれらは :ref:`Match オブジェクト <match-objects>` のインスタンスを返します。このオブジェクトにはマッチした情報が含まれます: マッチの開始と終了位置、マッチした部分文字列、など。"
773793
774794#: ../../howto/regex.rst:380
775795msgid ""
@@ -801,6 +821,9 @@ msgid ""
801821" which will cause the interpreter to print no output. You can explicitly "
802822"print the result of :meth:`!match` to make this clear. ::"
803823msgstr ""
824+ "さて、いろいろな文字列を使って正規表現 ``[a-z]+`` に対するマッチングを試してみましょう。空の文字列は全くマッチしません、なぜなら ``+``"
825+ " は「1 回以上の繰り返し」を意味するからです。この場合では :meth:`~re.Pattern.match` は ``None`` "
826+ "を返すべきで、インタプタは何も出力しません。明確にするために :meth:`!match` の結果を明示的に出力することもできます::"
804827
805828#: ../../howto/regex.rst:405
806829msgid ""
@@ -809,13 +832,17 @@ msgid ""
809832"<match-objects>`, so you should store the result in a variable for later "
810833"use. ::"
811834msgstr ""
835+ "では、今度はマッチするはずの文字列、例えば ``tempo`` を試してみましょう。このケースでは、 :meth:`~re.Pattern.match`"
836+ " は :ref:`match object <match-objects>` を返すので、後で使うために結果を変数に記憶しておくべきです。 ::"
812837
813838#: ../../howto/regex.rst:413
814839msgid ""
815840"Now you can query the :ref:`match object <match-objects>` for information "
816841"about the matching string. Match object instances also have several methods"
817842" and attributes; the most important ones are:"
818843msgstr ""
844+ "これでマッチした文字列についての情報を :ref:`Match オブジェクト <match-objects>` に問い合わせることが出来ます。\n"
845+ "Match オブジェクトインスタンスはいくつかのメソッドと属性も持っていて、最も重要なのは次のものです:"
819846
820847#: ../../howto/regex.rst:420
821848msgid "``group()``"
@@ -864,6 +891,9 @@ msgid ""
864891"scans through the string, so the match may not start at zero in that case. "
865892"::"
866893msgstr ""
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` メソッドではパターンを文字列全体について走査するので、マッチの開始はゼロにならないかもしれません。 ::"
867897
868898#: ../../howto/regex.rst:456
869899msgid ""
@@ -879,6 +909,8 @@ msgid ""
879909"Two pattern methods return all of the matches for a pattern. "
880910":meth:`~re.Pattern.findall` returns a list of matching strings::"
881911msgstr ""
912+ "あるパターンにマッチするもの全てを返す Pattern インスタンスのメソッドが2つあります。\n"
913+ ":meth:`~re.Pattern.findall` はマッチした文字列のリストを返します::"
882914
883915#: ../../howto/regex.rst:474
884916msgid ""
0 commit comments