diff --git a/library/re.po b/library/re.po index 0ea543e1..69ec71b2 100644 --- a/library/re.po +++ b/library/re.po @@ -1729,6 +1729,13 @@ msgid "" "compiled regular expression object, ``rx.search(string, 0, 50)`` is " "equivalent to ``rx.search(string[:50], 0)``." msgstr "" +"Le paramètre optionnel *endpos* limite la longueur sur laquelle la chaîne " +"sera analysée ; ce sera comme si la chaîne faisait *endpos* caractères de " +"long, donc uniquement les caractères de *pos* à ``endpos - 1`` seront " +"analysés pour trouver une correspondance. Si *endpos* est inférieur à " +"*pos*, aucune correspondance ne sera trouvée ; dit autrement, avec *rx* une " +"expression rationnelle compilée, ``rx.search(string, 0, 50)`` est équivalent " +"à ``rx.search(string[:50], 0)``." #: ../Doc/library/re.rst:881 msgid "" @@ -1737,18 +1744,26 @@ msgid "" "Return ``None`` if the string does not match the pattern; note that this is " "different from a zero-length match." msgstr "" +"Si zéro caractère ou plus au début de *string* correspondent à cette " +"expression rationnelle, renvoie l':ref:`objet de correspondance ` trouvé. Renvoie ``None`` si la chaîne ne correspond pas au motif ; " +"notez que cela est différent d'une correspondance vide." #: ../Doc/library/re.rst:886 ../Doc/library/re.rst:904 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~regex.search` method." msgstr "" +"Les paramètres optionnels *pos* et *endpos* ont le même sens que pour la " +"méthode :meth:`~regex.search`." #: ../Doc/library/re.rst:894 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~regex." "search` instead (see also :ref:`search-vs-match`)." msgstr "" +"Si vous voulez une recherche n'importe où dans *string*, utilisez plutôt :" +"meth:`~regex.search` (voir aussi :ref:`search-vs-match`)." #: ../Doc/library/re.rst:900 msgid "" @@ -1757,10 +1772,14 @@ msgid "" "string does not match the pattern; note that this is different from a zero-" "length match." msgstr "" +"Si la chaîne *string* entière valide l'expression rationnelle, renvoie l':" +"ref:`object de correspondance ` associé. Renvoie ``None`` si " +"la chaîne ne correspond pas au motif ; notez que cela est différent d'une " +"correspondance vide." #: ../Doc/library/re.rst:918 msgid "Identical to the :func:`split` function, using the compiled pattern." -msgstr "" +msgstr "Identique à la fonction :func:`split`, en utilisant le motif compilé." #: ../Doc/library/re.rst:923 msgid "" @@ -1768,6 +1787,9 @@ msgid "" "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`match`." msgstr "" +"Similaire à la fonction :func:`findall`, en utilisant le motif compilé, mais " +"accepte aussi des paramètres *pos* et *endpos* optionnels qui limitent la " +"région de recherche comme pour :meth:`match`." #: ../Doc/library/re.rst:930 msgid "" @@ -1775,6 +1797,9 @@ msgid "" "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`match`." msgstr "" +"Similaire à la fonction :func:`finditer`, en utilisant le motif compilé, " +"mais accepte aussi des paramètres *pos* et *endpos* optionnels qui limitent " +"la région de recherche comme pour :meth:`match`." #: ../Doc/library/re.rst:937 msgid "Identical to the :func:`sub` function, using the compiled pattern." @@ -1930,6 +1955,10 @@ msgid "" "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given:" msgstr "" +"Si on rend la partie décimale et tout ce qui la suit optionnels, tous les " +"groupes ne figureront pas dans la correspondance. Ces groupes sans " +"correspondance vaudront ``None`` sauf si une autre valeur est donnée à " +"l'argument *default* :" #: ../Doc/library/re.rst:1090 msgid "" @@ -1937,6 +1966,10 @@ msgid "" "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example:" msgstr "" +"Renvoie un dictionnaire contenant tous les sous-groupes *nommés* de la " +"correspondance, accessibles par leurs noms. L'argument *default* est " +"utilisé pour les groupes qui ne figurent pas dans la correspondance ; il " +"vaut ``None`` par défaut. Par exemple :" #: ../Doc/library/re.rst:1102 msgid "" @@ -1946,6 +1979,12 @@ msgid "" "object *m*, and a group *g* that did contribute to the match, the substring " "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" +"Renvoie les indices de début et de fin de la sous-chaîne correspondant au " +"groupe *group* ; *group* vaut par défaut zéro (pour récupérer les indices de " +"la correspondance complète). Renvoie ``-1`` si *group* existe mais ne figure " +"pas dans la correspondance. Pour un objet de correspondance *m*, et un " +"groupe *g* qui y figure, la sous-chaîne correspondant au groupe *g* " +"(équivalente à ``m.group(g)``) est : ::" #: ../Doc/library/re.rst:1110 msgid "" @@ -1954,10 +1993,15 @@ msgid "" "start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both " "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" +"Notez que ``m.start(group)`` sera égal à ``m.end(group)`` si *group* " +"correspond à une chaîne vide. Par exemple, après ``m = re.search('b(c?)', " +"'cba')``, ``m.start(0)`` vaut 1, ``m.end(0)`` vaut 2, ``m.start(1)`` et ``m." +"end(1)`` valent tous deux 2, et ``m.start(2)`` lève une exception :exc:" +"`IndexError`." #: ../Doc/library/re.rst:1115 msgid "An example that will remove *remove_this* from email addresses:" -msgstr "" +msgstr "Un exemple qui supprimera *remove_this* d'une adresse email :" #: ../Doc/library/re.rst:1125 msgid "" @@ -1965,6 +2009,10 @@ msgid "" "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" +"Pour un objet de correspondance *m*, renvoie le *tuple* ``(m.start(group), m." +"end(group))``. Notez que si *group* ne figure pas dans la correspondance, " +"``(-1, -1)`` est renvoyé. *group* vaut par défaut zéro, pour la " +"correspondance entière." #: ../Doc/library/re.rst:1132 msgid "" @@ -1972,6 +2020,10 @@ msgid "" "`~regex.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" +"La valeur de *pos* qui a été passée à la méthode :meth:`~regex.search` ou :" +"meth:`~regex.match` d'un :ref:`objet expression rationnelle `. " +"C'est l'index dans la chaîne à partir duquel le moteur d'expressions " +"rationnelles recherche une correspondance." #: ../Doc/library/re.rst:1139 msgid "" @@ -1979,6 +2031,10 @@ msgid "" "`~regex.match` method of a :ref:`regex object `. This is the " "index into the string beyond which the RE engine will not go." msgstr "" +"La valeur de *endpos* qui a été passée à la méthode :meth:`~regex.search` " +"ou :meth:`~regex.match` d'un :ref:`objet expression rationnelle `. C'est l'index dans la chaîne que le moteur d'expressions " +"rationnelles ne dépassera pas." #: ../Doc/library/re.rst:1146 msgid "" @@ -1988,36 +2044,47 @@ msgid "" "``'ab'``, while the expression ``(a)(b)`` will have ``lastindex == 2``, if " "applied to the same string." msgstr "" +"L'index entier du dernier groupe de capture validé, ou ``None`` si aucun " +"groupe ne correspondait. Par exemple, les expressions ``(a)b``, ``((a)(b))`` " +"et ``((ab))`` auront un ``lastindex == 1`` si appliquées à la chaîne " +"``'ab'``, alors que l'expression ``(a)(b)`` aura un ``lastindex == 2`` si " +"appliquée à la même chaîne." #: ../Doc/library/re.rst:1155 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" +"Le nom du dernier groupe capturant validé, ou ``None`` si le groupe n'a pas " +"de nom, ou si aucun groupe ne correspondait." #: ../Doc/library/re.rst:1161 msgid "" "The regular expression object whose :meth:`~regex.match` or :meth:`~regex." "search` method produced this match instance." msgstr "" +"L'expression rationnelle dont la méthode :meth:`~regex.match` ou :meth:" +"`~regex.search` a produit cet objet de correspondance." #: ../Doc/library/re.rst:1167 msgid "The string passed to :meth:`~regex.match` or :meth:`~regex.search`." -msgstr "" +msgstr "La chaîne passée à :meth:`~regex.match` ou :meth:`~regex.search`." #: ../Doc/library/re.rst:1173 msgid "Regular Expression Examples" -msgstr "" +msgstr "Exemples d'expressions rationnelles" #: ../Doc/library/re.rst:1177 msgid "Checking for a Pair" -msgstr "" +msgstr "Rechercher une paire" #: ../Doc/library/re.rst:1179 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully:" msgstr "" +"Dans cet exemple, nous utiliserons cette fonction de facilité pour afficher " +"les objets de correspondance sous une meilleure forme :" #: ../Doc/library/re.rst:1189 msgid "" @@ -2026,10 +2093,18 @@ msgid "" "ace, \"k\" for king, \"q\" for queen, \"j\" for jack, \"t\" for 10, and " "\"2\" through \"9\" representing the card with that value." msgstr "" +"Supposez que vous écriviez un jeu de poker où la main d'un joueur est " +"représentée par une chaîne de 5 caractères avec chaque caractère " +"représentant une carte, \"a\" pour l'as, \"k\" pour le roi (*king*), \"q\" " +"pour la reine (*queen*), \"j\" pour le valet (*jack*), \"t\" pour 10 " +"(*ten*), et les caractères de \"2\" à \"9\" représentant les cartes avec ces " +"valeurs." #: ../Doc/library/re.rst:1194 msgid "To see if a given string is a valid hand, one could do the following:" msgstr "" +"Pour vérifier qu'une chaîne donnée est une main valide, on pourrait faire " +"comme suit :" #: ../Doc/library/re.rst:1204 msgid "" @@ -2037,16 +2112,22 @@ msgid "" "cards. To match this with a regular expression, one could use backreferences " "as such:" msgstr "" +"La dernière main, ``\"727ak\"``, contenait une paire, deux cartes de la même " +"valeur. Pour valider cela avec une expression rationnelle, on pourrait " +"utiliser des références arrière comme :" #: ../Doc/library/re.rst:1214 msgid "" "To find out what card the pair consists of, one could use the :meth:`~match." "group` method of the match object in the following manner:" msgstr "" +"Pour trouver de quelle carte est composée la paire, on pourrait utiliser la " +"méthode :meth:`~match.group` de l'objet de correspondance de la manière " +"suivante :" #: ../Doc/library/re.rst:1234 msgid "Simulating scanf()" -msgstr "" +msgstr "Simuler scanf()" #: ../Doc/library/re.rst:1238 msgid "" @@ -2056,14 +2137,19 @@ msgid "" "equivalent mappings between :c:func:`scanf` format tokens and regular " "expressions." msgstr "" +"Python n'a actuellement pas d'équivalent à la fonction C :c:func:`scanf`. " +"Les expressions rationnelles sont généralement plus puissantes, mais aussi " +"plus verbeuses, que les chaînes de format :c:func:`scanf`. Le tableau " +"suivant présente des expressions rationnelles plus ou moins équivalentes aux " +"éléments de formats de :c:func:`scanf`." #: ../Doc/library/re.rst:1245 msgid ":c:func:`scanf` Token" -msgstr "" +msgstr "Élément de :c:func:`scanf`" #: ../Doc/library/re.rst:1245 msgid "Regular Expression" -msgstr "" +msgstr "Expression rationnelle" #: ../Doc/library/re.rst:1247 msgid "``%c``" @@ -2140,18 +2226,19 @@ msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" #: ../Doc/library/re.rst:1266 msgid "To extract the filename and numbers from a string like ::" msgstr "" +"Pour extraire le nom de fichier et les nombres depuis une chaîne comme : ::" #: ../Doc/library/re.rst:1270 msgid "you would use a :c:func:`scanf` format like ::" -msgstr "" +msgstr "vous utiliseriez un format :c:func:`scanf` comme : ::" #: ../Doc/library/re.rst:1274 msgid "The equivalent regular expression would be ::" -msgstr "" +msgstr "L'expression rationnelle équivalente serait : ::" #: ../Doc/library/re.rst:1282 msgid "search() vs. match()" -msgstr "" +msgstr "search() vs. match()" #: ../Doc/library/re.rst:1286 msgid "" @@ -2160,6 +2247,10 @@ msgid "" "the string, while :func:`re.search` checks for a match anywhere in the " "string (this is what Perl does by default)." msgstr "" +"Python offre deux opérations primitives basées sur les expressions " +"rationnelles : :func:`re.match` cherche une correspondance uniquement au " +"début de la chaîne, tandis que :func:`re.search` en recherche une n'importe " +"où dans la chaîne (ce que fait Perl par défaut)." #: ../Doc/library/re.rst:1291 msgid "For example::" @@ -2170,6 +2261,8 @@ msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" +"Les expressions rationnelles commençant par ``'^'`` peuvent être utilisées " +"avec :func:`search` pour restreindre la recherche au début de la chaîne : ::" #: ../Doc/library/re.rst:1305 msgid "" @@ -2177,10 +2270,13 @@ msgid "" "the beginning of the string, whereas using :func:`search` with a regular " "expression beginning with ``'^'`` will match at the beginning of each line." msgstr "" +"Notez cependant qu'en mode :const:`MULTILINE`, :func:`match`ne recherche " +"qu'au début de la chaîne, alors que :func:`search` avec une expression " +"rationnelle commençant par ``'^'`` recherchera au début de chaque ligne." #: ../Doc/library/re.rst:1315 msgid "Making a Phonebook" -msgstr "" +msgstr "Construire un répertoire téléphonique" #: ../Doc/library/re.rst:1317 msgid "" @@ -2189,18 +2285,27 @@ msgid "" "that can be easily read and modified by Python as demonstrated in the " "following example that creates a phonebook." msgstr "" +":func:`split` découpe une chaîne en une liste délimitée par le motif donné. " +"La méthode est inestimable pour convertir des données textuelles vers des " +"structures de données qui peuvent être lues et modifiées par Python comme " +"démontré dans l'exemple suivant qui crée un répertoire téléphonique." #: ../Doc/library/re.rst:1322 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax:" msgstr "" +"Premièrement, voici l'entrée. Elle provient normalement d'un fichier, nous " +"utilisons ici une chaîne à guillemets triples :" #: ../Doc/library/re.rst:1333 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" +"Les entrées sont séparées par un saut de ligne ou plus. Nous convertissons " +"maintenant la chaîne en une liste où chaque ligne non vide aura sa propre " +"entrée :" #: ../Doc/library/re.rst:1346 msgid "" @@ -2208,6 +2313,10 @@ msgid "" "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" +"Finalement, on sépare chaque entrée en une liste avec prénom, nom, numéro de " +"téléphone et adresse. Nous utilisons le paramètre ``maxsplit`` de :func:" +"`split` parce que l'adresse contient des espaces, qui sont notre motif de " +"séparation :" #: ../Doc/library/re.rst:1359 msgid "" @@ -2215,10 +2324,13 @@ msgid "" "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" +"Le motif ``:?`` trouve les deux points derrière le nom de famille, pour " +"qu'ils n'apparaissent pas dans la liste résultante. Avec un ``maxsplit`` de " +"``4``, nous pourrions séparer le numéro du nom de la rue." #: ../Doc/library/re.rst:1374 msgid "Text Munging" -msgstr "" +msgstr "Mélanger les lettres des mots" #: ../Doc/library/re.rst:1376 msgid "" @@ -2227,10 +2339,14 @@ msgid "" "function to \"munge\" text, or randomize the order of all the characters in " "each word of a sentence except for the first and last characters::" msgstr "" +":func:`sub` remplace toutes les occurrences d'un motif par une chaîne ou le " +"résultat d'une fonction. Cet exemple le montre, en utilisant :func:`sub` " +"avec une fonction qui mélange aléatoirement les caractères de chaque mot " +"dans une phrase (à l'exception des premiers et derniers caractères) : ::" #: ../Doc/library/re.rst:1393 msgid "Finding all Adverbs" -msgstr "" +msgstr "Trouver tous les adverbes" #: ../Doc/library/re.rst:1395 msgid "" @@ -2239,10 +2355,14 @@ msgid "" "find all of the adverbs in some text, he or she might use :func:`findall` in " "the following manner:" msgstr "" +":func:`findall` trouve *toutes* les occurrences d'un motif, pas juste la " +"première comme le fait :func:`search`. Par exemple, si un(e) écrivain(e) " +"voulait trouver tous les adverbes dans un texte, il/elle devrait utiliser :" +"func:`findall` de la manière suivante :" #: ../Doc/library/re.rst:1406 msgid "Finding all Adverbs and their Positions" -msgstr "" +msgstr "Trouver tous les adverbes et leurs positions" #: ../Doc/library/re.rst:1408 msgid "" @@ -2253,10 +2373,16 @@ msgid "" "positions* in some text, he or she would use :func:`finditer` in the " "following manner:" msgstr "" +"Pour obtenir plus d'informations sur les correspondances que juste le texte " +"trouvé, :func:`finditer` est utile en fournissant des :ref:`objets de " +"correspondance ` plutôt que des chaînes. En continuant avec " +"le précédent exemple, si l'écrivain(e) voulait trouver tous les adverbes *et " +"leurs positions* dans un texte, il/elle utiliserait :func:`finditer` de la " +"manière suivante :" #: ../Doc/library/re.rst:1422 msgid "Raw String Notation" -msgstr "" +msgstr "Notation brutes de chaînes" #: ../Doc/library/re.rst:1424 msgid "" @@ -2265,6 +2391,11 @@ msgid "" "prefixed with another one to escape it. For example, the two following " "lines of code are functionally identical:" msgstr "" +"La notation brute de chaînes (``r\"text\"``) garde saines les expressions " +"rationnelles. Sans elle, chaque *backslash* (``'\\'``) dans une expression " +"rationnelle devrait être préfixé d'un autre *backslash* pour l'échapper. " +"Par exemple, les deux lignes de code suivantes sont fonctionnellement " +"identiques :" #: ../Doc/library/re.rst:1434 msgid "" @@ -2273,10 +2404,14 @@ msgid "" "Without raw string notation, one must use ``\"\\\\\\\\\"``, making the " "following lines of code functionally identical:" msgstr "" +"Pour rechercher un *backslash* littéral, il faut l'échapper dans " +"l'expression rationnelle. Avec la notation brute, cela signifie ``r\"\\\\" +"\"``. Sans elle, il faudrait utiliser ``\"\\\\\\\\\"``, faisant que les " +"deux lignes de code suivantes sont fonctionnellement identiques :" #: ../Doc/library/re.rst:1446 msgid "Writing a Tokenizer" -msgstr "" +msgstr "Écrire un analyseur lexical" #: ../Doc/library/re.rst:1448 msgid "" @@ -2284,6 +2419,10 @@ msgid "" "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" +"Un `analyseur lexical ou scanner `_ analyse une chaîne pour catégoriser les groupes de " +"caractères. C'est une première étape utile dans l'écriture d'un compilateur " +"ou d'un interpréteur." #: ../Doc/library/re.rst:1452 msgid "" @@ -2291,7 +2430,10 @@ msgid "" "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" +"Les catégories de texte sont spécifiées par des expressions rationnelles. " +"La technique est de les combiner dans une unique expression rationnelle " +"maîtresse, et de boucler sur les correspondances successives : ::" #: ../Doc/library/re.rst:1502 msgid "The tokenizer produces the following output::" -msgstr "" +msgstr "L'analyseur produit la sortie suivante : ::"