# SOME DESCRIPTIVE TITLE. # Copyright (C) 1990-2016, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 2.7\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-10-30 10:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../Doc/library/re.rst:3 msgid ":mod:`re` --- Regular expression operations" msgstr ":mod:`re` --- Opérations à base d'expressions rationnelles" #: ../Doc/library/re.rst:11 msgid "" "This module provides regular expression matching operations similar to those " "found in Perl. Both patterns and strings to be searched can be Unicode " "strings as well as 8-bit strings." msgstr "" #: ../Doc/library/re.rst:15 msgid "" "Regular expressions use the backslash character (``'\\'``) to indicate " "special forms or to allow special characters to be used without invoking " "their special meaning. This collides with Python's usage of the same " "character for the same purpose in string literals; for example, to match a " "literal backslash, one might have to write ``'\\\\\\\\'`` as the pattern " "string, because the regular expression must be ``\\\\``, and each backslash " "must be expressed as ``\\\\`` inside a regular Python string literal." msgstr "" "Les expressions rationnelles utilisent le caractère *backslash* (``'\\'``) " "pour indiquer des formes spéciales ou permettre d'utiliser des caractères " "spéciaux sans en invoquer le sens. Cela entre en conflit avec l'utilisation " "en Python du même caractère pour la même raison dans les chaînes " "littérales ; par exemple, pour rechercher un *backslash* littéral il " "faudrait écrire ``'\\\\\\\\'`` comme motif, parce que l'expression " "rationnelle devrait être ``\\\\`` et chaque *backslash* doit être représenté " "par ``\\\\`` au sein des chaînes littérales Python." #: ../Doc/library/re.rst:24 msgid "" "The solution is to use Python's raw string notation for regular expression " "patterns; backslashes are not handled in any special way in a string literal " "prefixed with ``'r'``. So ``r\"\\n\"`` is a two-character string containing " "``'\\'`` and ``'n'``, while ``\"\\n\"`` is a one-character string containing " "a newline. Usually patterns will be expressed in Python code using this raw " "string notation." msgstr "" "La solution est d'utiliser la notation des chaînes brutes en Python pour les " "expressions rationnelles ; Les *backslashs* ne provoquent aucun traitement " "spécifique dans les chaînes littérales préfixées par ``'r'``. Ainsi, ``r\"\\n" "\"`` est une chaîne de deux caractères contenant ``'\\'`` et ``'n'``, tandis " "que ``\"\\n\"`` est une chaîne contenant un unique caractère : un saut de " "ligne. Généralement, les motifs seront exprimés en Python à l'aide de " "chaînes brutes." #: ../Doc/library/re.rst:31 msgid "" "It is important to note that most regular expression operations are " "available as module-level functions and :class:`RegexObject` methods. The " "functions are shortcuts that don't require you to compile a regex object " "first, but miss some fine-tuning parameters." msgstr "" #: ../Doc/library/re.rst:40 msgid "Regular Expression Syntax" msgstr "Syntaxe des expressions rationnelles" #: ../Doc/library/re.rst:42 msgid "" "A regular expression (or RE) specifies a set of strings that matches it; the " "functions in this module let you check if a particular string matches a " "given regular expression (or if a given regular expression matches a " "particular string, which comes down to the same thing)." msgstr "" "Une expression rationnelle (*regular expression* ou *RE*) spécifie un " "ensemble de chaînes de caractères qui lui correspondent ; les fonctions de " "ce module vous permettent de vérifier si une chaîne particulière correspond " "à une expression rationnelle donnée (ou si un expression rationnelle donnée " "correspond à une chaîne particulière, ce qui revient à la même chose)." #: ../Doc/library/re.rst:47 msgid "" "Regular expressions can be concatenated to form new regular expressions; if " "*A* and *B* are both regular expressions, then *AB* is also a regular " "expression. In general, if a string *p* matches *A* and another string *q* " "matches *B*, the string *pq* will match AB. This holds unless *A* or *B* " "contain low precedence operations; boundary conditions between *A* and *B*; " "or have numbered group references. Thus, complex expressions can easily be " "constructed from simpler primitive expressions like the ones described " "here. For details of the theory and implementation of regular expressions, " "consult the Friedl book referenced above, or almost any textbook about " "compiler construction." msgstr "" "Les expressions rationnelles peuvent être concaténées pour former de " "nouvelles expressions : si *A* et *B* sont deux expressions rationnelles, " "alors *AB* est aussi une expression rationnelle. En général, si une chaîne " "*p* valide *A* et qu'une autre chaîne *q* valide *B*, la chaîne *pq* " "validera AB. Cela est vrai tant que *A* et *B* ne contiennent pas " "d'opérations de précédence ; de conditions liées entre *A* et *B* ; ou de " "références vers des groupes numérotés. Ainsi, des expressions complexes " "peuvent facilement être construites depuis de plus simples expressions " "primitives comme celles décrites ici. Pour plus de détails sur la théorie " "et l'implémentation des expressions rationnelles, consultez le livre de " "Frield référencé plus tôt, ou à peu près n'importe quel livre dédié à la " "construction de compilateurs." #: ../Doc/library/re.rst:57 msgid "" "A brief explanation of the format of regular expressions follows. For " "further information and a gentler presentation, consult the :ref:`regex-" "howto`." msgstr "" "Une brève explication sur le format des expressions rationnelles suit. Pour " "de plus amples informations et une présentation plus simple, référez-vous " "au :ref:`regex-howto`." #: ../Doc/library/re.rst:60 msgid "" "Regular expressions can contain both special and ordinary characters. Most " "ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest " "regular expressions; they simply match themselves. You can concatenate " "ordinary characters, so ``last`` matches the string ``'last'``. (In the " "rest of this section, we'll write RE's in ``this special style``, usually " "without quotes, and strings to be matched ``'in single quotes'``.)" msgstr "" "Les expressions rationnelles peuvent contenir à la fois des caractères " "spéciaux et ordinaires. Les plus ordinaires, comme ``'A'``, ``'a'`` ou " "``'0'`` sont les expressions rationnelles les plus simples : elles " "correspondent simplement à elles-mêmes. Vous pouvez concaténer des " "caractères ordinaires, ainsi ``last`` correspond à la chaîne ``'last'``. " "(Dans la suite de cette section, nous écrirons les expressions rationnelles " "dans ``ce style spécifique``, généralement sans guillemets, et les chaînes à " "tester ``'entourées de simples guillemets'``.)" #: ../Doc/library/re.rst:67 msgid "" "Some characters, like ``'|'`` or ``'('``, are special. Special characters " "either stand for classes of ordinary characters, or affect how the regular " "expressions around them are interpreted. Regular expression pattern strings " "may not contain null bytes, but can specify the null byte using the ``" "\\number`` notation, e.g., ``'\\x00'``." msgstr "" #: ../Doc/library/re.rst:73 msgid "" "Repetition qualifiers (``*``, ``+``, ``?``, ``{m,n}``, etc) cannot be " "directly nested. This avoids ambiguity with the non-greedy modifier suffix " "``?``, and with other modifiers in other implementations. To apply a second " "repetition to an inner repetition, parentheses may be used. For example, the " "expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters." msgstr "" "Les caractères de répétition (``*``, ``+``, ``?``, ``{m,n}``, etc.) ne " "peuvent être directement imbriqués. Cela empêche l'ambiguïté avec le suffixe " "modificateur non gourmand ``?`` et avec les autres modificateurs dans " "d'autres implémentations. Pour appliquer une seconde répétition à une " "première, des parenthèses peuvent être utilisées. Par exemple, l'expression " "``(?:a{6})*`` valide toutes les chaînes composées d'un nombre de caractères " "``'a'`` multiple de six." #: ../Doc/library/re.rst:80 msgid "The special characters are:" msgstr "Les caractères spéciaux sont :" #: ../Doc/library/re.rst:85 msgid "``'.'``" msgstr "``'.'``" #: ../Doc/library/re.rst:83 msgid "" "(Dot.) In the default mode, this matches any character except a newline. " "If the :const:`DOTALL` flag has been specified, this matches any character " "including a newline." msgstr "" "(Point.) Dans le mode par défaut, il valide tout caractère à l'exception du " "saut de ligne. Si l'option :const:`DOTALL` a été spécifiée, il valide tout " "caractère, saut de ligne compris." #: ../Doc/library/re.rst:89 msgid "``'^'``" msgstr "``'^'``" #: ../Doc/library/re.rst:88 msgid "" "(Caret.) Matches the start of the string, and in :const:`MULTILINE` mode " "also matches immediately after each newline." msgstr "" "(Accent circonflexe.) Valide le début d'une chaîne de caractères, ainsi que " "ce qui suit chaque saut de ligne en mode :const:`MULTILINE`." #: ../Doc/library/re.rst:98 msgid "``'$'``" msgstr "``'$'``" #: ../Doc/library/re.rst:92 msgid "" "Matches the end of the string or just before the newline at the end of the " "string, and in :const:`MULTILINE` mode also matches before a newline. " "``foo`` matches both 'foo' and 'foobar', while the regular expression ``foo" "$`` matches only 'foo'. More interestingly, searching for ``foo.$`` in " "``'foo1\\nfoo2\\n'`` matches 'foo2' normally, but 'foo1' in :const:" "`MULTILINE` mode; searching for a single ``$`` in ``'foo\\n'`` will find two " "(empty) matches: one just before the newline, and one at the end of the " "string." msgstr "" "Valide la fin d'une chaîne de caractères, ou juste avant le saut de ligne à " "la fin de la chaîne, ainsi qu'avant chaque saut de ligne en mode :const:" "`MULTILINE`. ``foo`` valide à la fois *foo* et *foobar*, tandis que " "l'expression rationnelle ``foo$`` ne correspond qu'à ``'foo'``. Plus " "intéressant, chercher ``foo.$`` dans ``'foo1\\nfoo2\\n'`` trouve normalement " "``'foo2'``, mais ``'foo1'`` en mode :const:`MULTILINE` ; chercher un simple " "``$`` dans ``'foo\\n'`` trouvera deux correspondances (vides) : une juste " "avant le saut de ligne, et une à la fin de la chaîne." #: ../Doc/library/re.rst:103 msgid "``'*'``" msgstr "``'*'``" #: ../Doc/library/re.rst:101 msgid "" "Causes the resulting RE to match 0 or more repetitions of the preceding RE, " "as many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' " "followed by any number of 'b's." msgstr "" "Fait valider par l'expression rationnelle résultante 0 répétition ou plus de " "l'expression qui précède, avec autant de répétitions que possible. ``ab*`` " "validera 'a', 'ab' ou 'a' suivi de n'importe quel nombre de 'b'." #: ../Doc/library/re.rst:108 msgid "``'+'``" msgstr "``'+'``" #: ../Doc/library/re.rst:106 msgid "" "Causes the resulting RE to match 1 or more repetitions of the preceding RE. " "``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not " "match just 'a'." msgstr "" "Fait valider par l'expression rationnelle résultante 1 répétition ou plus de " "l'expression qui précède. ``ab+`` validera 'a' suivi de n'importe quel " "nombre non nul de 'b' ; cela ne validera pas la chaîne 'a'." #: ../Doc/library/re.rst:112 msgid "``'?'``" msgstr "``'?'``" #: ../Doc/library/re.rst:111 msgid "" "Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. " "``ab?`` will match either 'a' or 'ab'." msgstr "" "Fait valider par l'expression rationnelle résultante 0 ou 1 répétition de " "l'expression qui précède. ``ab?`` correspondra à 'a' ou 'ab'." #: ../Doc/library/re.rst:121 msgid "``*?``, ``+?``, ``??``" msgstr "``*?``, ``+?``, ``??``" #: ../Doc/library/re.rst:115 msgid "" "The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they " "match as much text as possible. Sometimes this behaviour isn't desired; if " "the RE ``<.*>`` is matched against `` b ``, it will match the entire " "string, and not just ````. Adding ``?`` after the qualifier makes it " "perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* " "characters as possible will be matched. Using the RE ``<.*?>`` will match " "only ````." msgstr "" "Les qualificateurs ``'*'``, ``'+'`` et ``'?'`` sont tous :dfn:`greedy` " "(gourmands) ; ils valident autant de texte que possible. Parfois ce " "comportement n'est pas désiré ; si l'expression rationnelle ``<.*>`` est " "testée avec la chaîne `` b ``, cela correspondra à la chaîne entière, " "et non juste à ````. Ajouter ``?`` derrière le qualificateur lui fait " "réaliser l'opération de façon :dfn:`non-greedy` (ou :dfn:`minimal`) ; le " "*moins* de caractères possibles seront validés. Utiliser l'expression " "rationnelle ``<.*?>`` validera uniquement ````." #: ../Doc/library/re.rst:126 msgid "``{m}``" msgstr "``{m}``" #: ../Doc/library/re.rst:124 msgid "" "Specifies that exactly *m* copies of the previous RE should be matched; " "fewer matches cause the entire RE not to match. For example, ``a{6}`` will " "match exactly six ``'a'`` characters, but not five." msgstr "" "Spécifie qu'exactement *m* copies de l'expression rationnelle qui précède " "devront être validées ; un nombre plus faible de correspondances empêche " "l'expression entière de correspondre. Par exemple, ``a{6}`` correspondra " "exactement à six caractères ``'a'``, mais pas à cinq." #: ../Doc/library/re.rst:135 msgid "``{m,n}``" msgstr "``{m,n}``" #: ../Doc/library/re.rst:129 msgid "" "Causes the resulting RE to match from *m* to *n* repetitions of the " "preceding RE, attempting to match as many repetitions as possible. For " "example, ``a{3,5}`` will match from 3 to 5 ``'a'`` characters. Omitting *m* " "specifies a lower bound of zero, and omitting *n* specifies an infinite " "upper bound. As an example, ``a{4,}b`` will match ``aaaab`` or a thousand " "``'a'`` characters followed by a ``b``, but not ``aaab``. The comma may not " "be omitted or the modifier would be confused with the previously described " "form." msgstr "" "Implique à l'expression rationnelle résultante de valider entre *m* et *n* " "répétitions de l'expression qui précède, cherchant à en valider le plus " "possible. Par exemple, ``a{3,5}`` validera entre 3 et 5 caractères " "``'a'``. Omettre *m* revient à spécifier 0 comme borne inférieure, et " "omettre *n* à avoir une borne supérieure infinie. Par exemple, ``a{4,}b`` " "correspondra à ``aaaab`` ou à un millier de caractères ``'a'`` suivis d'un " "``b``, mais pas à ``aaab``. La virgule ne doit pas être omise, auquel cas le " "modificateur serait confondu avec la forme décrite précédemment." #: ../Doc/library/re.rst:142 msgid "``{m,n}?``" msgstr "``{m,n}?``" #: ../Doc/library/re.rst:138 msgid "" "Causes the resulting RE to match from *m* to *n* repetitions of the " "preceding RE, attempting to match as *few* repetitions as possible. This is " "the non-greedy version of the previous qualifier. For example, on the 6-" "character string ``'aaaaaa'``, ``a{3,5}`` will match 5 ``'a'`` characters, " "while ``a{3,5}?`` will only match 3 characters." msgstr "" "Fait valider par l'expression rationnelle résultante entre *m* et *n* " "répétitions de l'expression qui précède, cherchant à en valider le moins " "possible. Il s'agit de la version non gourmande du précédent qualificateur. " "Par exemple, dans la chaîne de 6 caractères ``'aaaaaa'``, ``a{3,5}`` " "trouvera 5 caractères ``'a'``, alors que ``a{3,5}?`` n'en trouvera que 3." #: ../Doc/library/re.rst:155 msgid "``'\\'``" msgstr "``'\\'``" #: ../Doc/library/re.rst:145 msgid "" "Either escapes special characters (permitting you to match characters like " "``'*'``, ``'?'``, and so forth), or signals a special sequence; special " "sequences are discussed below." msgstr "" "Échappe les caractères spéciaux (permettant d’identifier des caractères " "comme ``'*'``, ``'?'`` et autres) ou signale une séquence spéciale ; les " "séquences spéciales sont décrites ci-dessous." #: ../Doc/library/re.rst:149 msgid "" "If you're not using a raw string to express the pattern, remember that " "Python also uses the backslash as an escape sequence in string literals; if " "the escape sequence isn't recognized by Python's parser, the backslash and " "subsequent character are included in the resulting string. However, if " "Python would recognize the resulting sequence, the backslash should be " "repeated twice. This is complicated and hard to understand, so it's highly " "recommended that you use raw strings for all but the simplest expressions." msgstr "" "Si vous n'utilisez pas de chaînes brutes pour exprimer le motif, souvenez-" "vous que Python utilise aussi le *backslash* comme une séquence " "d'échappement dans les chaînes littérales ; si la séquence d'échappement " "n'est pas reconnue par l'interpréteur Python, le *backslash* et les " "caractères qui le suivent sont inclus dans la chaîne renvoyée. Cependant, si " "Python reconnait la séquence, le *backslash* doit être doublé (pour ne plus " "être reconnu). C'est assez compliqué et difficile à comprendre, c'est " "pourquoi il est hautement recommandé d'utiliser des chaînes brutes pour tout " "sauf les expressions les plus simples." #: ../Doc/library/re.rst:187 msgid "``[]``" msgstr "``[]``" #: ../Doc/library/re.rst:158 msgid "Used to indicate a set of characters. In a set:" msgstr "Utilisé pour indiquer un ensemble de caractères. Dans un ensemble :" #: ../Doc/library/re.rst:160 msgid "" "Characters can be listed individually, e.g. ``[amk]`` will match ``'a'``, " "``'m'``, or ``'k'``." msgstr "" "Les caractères peuvent être listés individuellement, e.g. ``[amk]`` " "correspondra à ``'a'``, ``'m'`` ou ``'k'``." #: ../Doc/library/re.rst:163 msgid "" "Ranges of characters can be indicated by giving two characters and " "separating them by a ``'-'``, for example ``[a-z]`` will match any lowercase " "ASCII letter, ``[0-5][0-9]`` will match all the two-digits numbers from " "``00`` to ``59``, and ``[0-9A-Fa-f]`` will match any hexadecimal digit. If " "``-`` is escaped (e.g. ``[a\\-z]``) or if it's placed as the first or last " "character (e.g. ``[a-]``), it will match a literal ``'-'``." msgstr "" "Des intervalles de caractères peuvent être indiqués en donnant deux " "caractères et les séparant par un ``'-'``, par exemple ``[a-z]`` " "correspondra à toute lettre minuscule *ASCII*, ``[0-5][0-9]`` à tous nombres " "de deux chiffres entre ``00` et ``59``, et ``[0-9A-Fa-f]`` correspondra à " "n'importe quel chiffre hexadécimal. Si ``'-'`` est échappé (``[a\\-z]``) ou " "s'il est placé comme premier ou dernier caractère (e.g. ``[a-]``), il " "correspondra à un ``'-'`` littéral." #: ../Doc/library/re.rst:170 msgid "" "Special characters lose their special meaning inside sets. For example, " "``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " "``'*'``, or ``')'``." msgstr "" "Les caractères spéciaux perdent leur sens à l'intérieur des ensembles. Par " "exemple, ``[(+*)]`` validera chacun des caractères littéraux ``'('``, " "``'+'``, ``'*'`` ou ``')'``." #: ../Doc/library/re.rst:174 msgid "" "Character classes such as ``\\w`` or ``\\S`` (defined below) are also " "accepted inside a set, although the characters they match depends on " "whether :const:`LOCALE` or :const:`UNICODE` mode is in force." msgstr "" #: ../Doc/library/re.rst:178 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " "the characters that are *not* in the set will be matched. For example, " "``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match " "any character except ``'^'``. ``^`` has no special meaning if it's not the " "first character in the set." msgstr "" "Les caractères qui ne sont pas dans un intervalle peuvent être trouvés avec " "l'ensemble complémentaire (:dfn:`complementing`). Si le premier caractère de " "l'ensemble est ``'^'``, tous les caractères qui *ne sont pas* dans " "l'ensemble seront validés. Par exemple, ``[^5]`` correspondra à tout " "caractère autre que ``'5'`` et ``[^^]`` validera n'importe quel caractère " "excepté ``'^'``. ``^`` n'a pas de sens particulier s'il n'est pas le premier " "caractère de l'ensemble." #: ../Doc/library/re.rst:185 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " "``[]()[{}]`` will both match a parenthesis." msgstr "" "Pour insérer un ``']'`` littéral dans un ensemble, il faut le précéder d'un " "*backslash* ou le placer au début de l'ensemble. Par exemple, ``[()[\\]{}]`` " "et ``[]()[{}]`` vont tous deux correspondre à une parenthèse, un crochet ou " "une accolade." #: ../Doc/library/re.rst:198 msgid "``'|'``" msgstr "``'|'``" #: ../Doc/library/re.rst:190 msgid "" "``A|B``, where A and B can be arbitrary REs, creates a regular expression " "that will match either A or B. An arbitrary number of REs can be separated " "by the ``'|'`` in this way. This can be used inside groups (see below) as " "well. As the target string is scanned, REs separated by ``'|'`` are tried " "from left to right. When one pattern completely matches, that branch is " "accepted. This means that once ``A`` matches, ``B`` will not be tested " "further, even if it would produce a longer overall match. In other words, " "the ``'|'`` operator is never greedy. To match a literal ``'|'``, use ``\\|" "``, or enclose it inside a character class, as in ``[|]``." msgstr "" "``A|B``, où A et B peuvent être deux expressions rationnelles arbitraires, " "crée une expression rationnelle qui validera à la fois A et B. Un nombre " "arbitraire d'expressions peuvent être séparées de cette façon par des " "``'|'``. Cela peut aussi être utilisé au sein de groupes (voir ci-" "dessous). Quand une chaîne cible est analysée, les expressions séparées par " "``'|'`` sont essayées de la gauche vers la droite. Quand un motif correspond " "complètement, cette branche est acceptée. Cela signifie qu'une fois que " "``A`` correspond, ``B`` ne sera pas testée plus loin, même si elle pourrait " "provoquer une plus ample correspondance. En d'autres termes, l'opérateur " "``'|'`` n'est jamais gourmand. Pour valider un ``'|'`` littéral, utilisez ``" "\\|``, ou enveloppez-le dans une classe de caractères, comme ``[|]``." #: ../Doc/library/re.rst:205 msgid "``(...)``" msgstr "``(...)``" #: ../Doc/library/re.rst:201 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " "a match has been performed, and can be matched later in the string with the " "``\\number`` special sequence, described below. To match the literals " "``'('`` or ``')'``, use ``\\(`` or ``\\)``, or enclose them inside a " "character class: ``[(] [)]``." msgstr "" "Valide n'importe quelle expression rationnelle comprise entre les " "parenthèses, et indique le début et la fin d'un groupe ; le contenu d'un " "groupe peut être récupéré après qu'une analyse a été effectuée, et peut être " "réutilisé plus loin dans la chaîne avec une séquence spéciale ``\\number``, " "décrite ci-dessous. Pour écrire des ``'('`` ou ``')'`` littéraux, utilisez " "``\\(`` ou ``\\)``, ou enveloppez-les dans une classe de caractères : ``[(] " "[)]``." #: ../Doc/library/re.rst:212 msgid "``(?...)``" msgstr "``(?...)``" #: ../Doc/library/re.rst:208 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " "what the meaning and further syntax of the construct is. Extensions usually " "do not create a new group; ``(?P...)`` is the only exception to this " "rule. Following are the currently supported extensions." msgstr "" "Il s'agit d'une notation pour les extensions (un ``'?'`` suivant une ``'('`` " "n'a pas de sens autrement). Le premier caractère après le ``'?'`` détermine " "quel sens donner à l'expression. Les extensions ne créent généralement pas " "de nouveaux groupes ; ``(?P...)`` est la seule exception à la règle. " "Retrouvez ci-dessous la liste des extensions actuellement supportées." #: ../Doc/library/re.rst:229 msgid "``(?iLmsux)``" msgstr "" #: ../Doc/library/re.rst:215 msgid "" "(One or more letters from the set ``'i'``, ``'L'``, ``'m'``, ``'s'``, " "``'u'``, ``'x'``.) The group matches the empty string; the letters set the " "corresponding flags: :const:`re.I` (ignore case), :const:`re.L` (locale " "dependent), :const:`re.M` (multi-line), :const:`re.S` (dot matches all), :" "const:`re.U` (Unicode dependent), and :const:`re.X` (verbose), for the " "entire regular expression. (The flags are described in :ref:`contents-of-" "module-re`.) This is useful if you wish to include the flags as part of the " "regular expression, instead of passing a *flag* argument to the :func:`re." "compile` function." msgstr "" #: ../Doc/library/re.rst:226 msgid "" "Note that the ``(?x)`` flag changes how the expression is parsed. It should " "be used first in the expression string, or after one or more whitespace " "characters. If there are non-whitespace characters before the flag, the " "results are undefined." msgstr "" #: ../Doc/library/re.rst:235 msgid "``(?:...)``" msgstr "``(?:...)``" #: ../Doc/library/re.rst:232 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " "*cannot* be retrieved after performing a match or referenced later in the " "pattern." msgstr "" "Une version sans capture des parenthèses habituelles. Valide n'importe " "quelle expression rationnelle à l'intérieur des parenthèses, mais la sous-" "chaîne correspondant au groupe *ne peut pas* être récupérée après l'analyse " "ou être référencée plus loin dans le motif." #: ../Doc/library/re.rst:260 msgid "``(?P...)``" msgstr "``(?P...)``" #: ../Doc/library/re.rst:238 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " "Python identifiers, and each group name must be defined only once within a " "regular expression. A symbolic group is also a numbered group, just as if " "the group were not named." msgstr "" "Similaires aux parenthèses habituelles, mais la sous-chaîne validée par le " "groupe est accessible via le nom *name* du groupe symbolique. Les noms de " "groupes doivent être des identifiants Python valides, et chaque nom de " "groupe ne doit être défini qu'une seule fois dans une expression " "rationnelle. Un groupe symbolique est aussi un groupe numéroté, de la même " "manière que si le groupe n'était pas nommé." #: ../Doc/library/re.rst:244 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" "Les groupes nommés peuvent être référencés dans trois contextes. Si le motif " "est ``(?P['\"]).*?(?P=quote)`` (i.e. correspondant à une chaîne " "entourée de guillemets simples ou doubles) :" #: ../Doc/library/re.rst:249 msgid "Context of reference to group \"quote\"" msgstr "Contexte de référence au groupe *quote*" #: ../Doc/library/re.rst:249 msgid "Ways to reference it" msgstr "Manières de le référencer" #: ../Doc/library/re.rst:251 msgid "in the same pattern itself" msgstr "lui-même dans le même motif" #: ../Doc/library/re.rst:251 msgid "``(?P=quote)`` (as shown)" msgstr "``(?P=quote)`` (comme vu)" #: ../Doc/library/re.rst:252 ../Doc/library/re.rst:259 msgid "``\\1``" msgstr "``\\1``" #: ../Doc/library/re.rst:254 msgid "when processing match object ``m``" msgstr "en analysant l'objet résultat ``m``" #: ../Doc/library/re.rst:254 msgid "``m.group('quote')``" msgstr "``m.group('quote')``" #: ../Doc/library/re.rst:255 msgid "``m.end('quote')`` (etc.)" msgstr "``m.end('quote')`` (etc.)" #: ../Doc/library/re.rst:257 msgid "in a string passed to the ``repl`` argument of ``re.sub()``" msgstr "dans une chaîne passée à l'argument ``repl`` de ``re.sub()``" #: ../Doc/library/re.rst:257 msgid "``\\g``" msgstr "``\\g``" #: ../Doc/library/re.rst:258 msgid "``\\g<1>``" msgstr "``\\g<1>``" #: ../Doc/library/re.rst:264 msgid "``(?P=name)``" msgstr "``(?P=name)``" #: ../Doc/library/re.rst:263 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" "Une référence arrière à un groupe nommé ; elle correspond à n'importe quel " "texte validé plus tôt par le groupe nommé *name*." #: ../Doc/library/re.rst:267 msgid "``(?#...)``" msgstr "``(?#...)``" #: ../Doc/library/re.rst:267 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "Un commentaire ; le contenu des parenthèses est simplement ignoré." #: ../Doc/library/re.rst:272 msgid "``(?=...)``" msgstr "``(?=...)``" #: ../Doc/library/re.rst:270 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a lookahead assertion. For example, ``Isaac (?=Asimov)`` " "will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" "Valide si ``...`` valide la suite, mais ne consomme rien de la chaîne. On " "appelle cela une assertion *lookahead*. Par exemple, ``Isaac (?=Asimov)`` " "correspondra à la chaîne ``'Isaac'`` seulement si elle est suivie par " "``'Asimov'``." #: ../Doc/library/re.rst:277 msgid "``(?!...)``" msgstr "``(?!...)``" #: ../Doc/library/re.rst:275 msgid "" "Matches if ``...`` doesn't match next. This is a negative lookahead " "assertion. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if " "it's *not* followed by ``'Asimov'``." msgstr "" "Valide si ``...`` ne valide pas la suite. C'est une assertion *lookahead* " "négative. Par exemple, ``Isaac (?!Asimov)`` correspondra à la chaîne " "``'Isaac'`` seulement si elle *n'est pas* suivie par ``'Asimov'``." #: ../Doc/library/re.rst:301 msgid "``(?<=...)``" msgstr "``(?<=...)``" #: ../Doc/library/re.rst:280 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " "lookbehind assertion`. ``(?<=abc)def`` will find a match in ``abcdef``, " "since the lookbehind will back up 3 characters and check if the contained " "pattern matches. The contained pattern must only match strings of some fixed " "length, meaning that ``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}" "`` are not. Group references are not supported even if they match strings " "of some fixed length. Note that patterns which start with positive " "lookbehind assertions will not match at the beginning of the string being " "searched; you will most likely want to use the :func:`search` function " "rather than the :func:`match` function:" msgstr "" #: ../Doc/library/re.rst:297 msgid "This example looks for a word following a hyphen:" msgstr "Cet exemple recherche un mot suivi d'un trait d'union :" #: ../Doc/library/re.rst:309 msgid "``(?)`` is a poor email matching pattern, which will match with " "``''`` as well as ``'user@host.com'``, but not with " "``'`` will use the substring matched " "by the group named ``name``, as defined by the ``(?P...)`` syntax. ``" "\\g`` uses the corresponding group number; ``\\g<2>`` is therefore " "equivalent to ``\\2``, but isn't ambiguous in a replacement such as ``" "\\g<2>0``. ``\\20`` would be interpreted as a reference to group 20, not a " "reference to group 2 followed by the literal character ``'0'``. The " "backreference ``\\g<0>`` substitutes in the entire substring matched by the " "RE." msgstr "" "Dans les arguments *repl* de type *string*, en plus des séquences " "d'échappement et références arrières décrites au-dessus, ``\\g`` " "utilisera la sous-chaîne correspondant au groupe nommé ``name``, comme " "défini par la syntaxe ``(?P...)``. ``\\g`` utilise le groupe " "numéroté associé ; ``\\g<2>`` est ainsi équivalent à ``\\2``, mais n'est pas " "ambigu dans un remplacement tel que ``\\g<2>0``, ``\\20`` serait interprété " "comme une référence au groupe 20, et non une référence au groupe 2 suivie " "par un caractère littéral ``'0'``. La référence arrière ``\\g<0>`` est " "remplacée par la sous-chaîne entière validée par l'expression rationnelle." #: ../Doc/library/re.rst:685 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" "Réalise la même opération que :func:`sub`, mais renvoie un *tuple* " "``(nouvelle_chaîne, nombre_de_substitutions_réalisées)``." #: ../Doc/library/re.rst:694 msgid "" "Return *string* with all non-alphanumerics backslashed; this is useful if " "you want to match an arbitrary literal string that may have regular " "expression metacharacters in it." msgstr "" #: ../Doc/library/re.rst:701 msgid "Clear the regular expression cache." msgstr "Vide le cache d'expressions rationnelles." #: ../Doc/library/re.rst:706 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " "parentheses) or when some other error occurs during compilation or " "matching. It is never an error if a string contains no match for a pattern." msgstr "" #: ../Doc/library/re.rst:715 msgid "Regular Expression Objects" msgstr "Objets d'expressions rationnelles" #: ../Doc/library/re.rst:719 msgid "" "The :class:`RegexObject` class supports the following methods and attributes:" msgstr "" #: ../Doc/library/re.rst:723 msgid "" "Scan through *string* looking for a location where this regular expression " "produces a match, and return a corresponding :class:`MatchObject` instance. " "Return ``None`` if no position in the string matches the pattern; note that " "this is different from finding a zero-length match at some point in the " "string." msgstr "" #: ../Doc/library/re.rst:728 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " "to slicing the string; the ``'^'`` pattern character matches at the real " "beginning of the string and at positions just after a newline, but not " "necessarily at the index where the search is to start." msgstr "" "Le second paramètre *pos* (optionnel) donne l'index dans la chaîne où la " "recherche doit débuter ; il vaut ``0`` par défaut. Cela n'est pas " "complètement équivalent à un *slicing* sur la chaîne ; le caractère de motif " "``'^'`` correspond au début réel de la chaîne et aux positions juste après " "un saut de ligne, mais pas nécessairement à l'index où la recherche commence." #: ../Doc/library/re.rst:734 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " "characters from *pos* to ``endpos - 1`` will be searched for a match. If " "*endpos* is less than *pos*, no match will be found, otherwise, if *rx* is a " "compiled regular expression object, ``rx.search(string, 0, 50)`` is " "equivalent to ``rx.search(string[:50], 0)``." msgstr "" #: ../Doc/library/re.rst:749 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`MatchObject` instance. Return " "``None`` if the string does not match the pattern; note that this is " "different from a zero-length match." msgstr "" #: ../Doc/library/re.rst:754 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~RegexObject.search` method." msgstr "" #: ../Doc/library/re.rst:762 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~RegexObject." "search` instead (see also :ref:`search-vs-match`)." msgstr "" #: ../Doc/library/re.rst:768 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "Identique à la fonction :func:`split`, en utilisant le motif compilé." #: ../Doc/library/re.rst:773 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "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:780 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "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:787 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "Identique à la fonction :func:`sub`, en utilisant le motif compilé." #: ../Doc/library/re.rst:792 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "Identique à la fonction :func:`subn`, en utilisant le motif compilé." #: ../Doc/library/re.rst:797 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile` and any ``(?...)`` inline flags in the pattern." msgstr "" #: ../Doc/library/re.rst:803 msgid "The number of capturing groups in the pattern." msgstr "Le nombre de groupes de capture dans le motif." #: ../Doc/library/re.rst:808 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" "Un dictionnaire associant les noms de groupes symboliques définis par ``(?" "P)`` aux groupes numérotés. Le dictionnaire est vide si aucun groupe " "symbolique n'est utilisé dans le motif." #: ../Doc/library/re.rst:815 msgid "The pattern string from which the RE object was compiled." msgstr "" "La chaîne de motif depuis laquelle l'objet expression rationnelle a été " "compilé." #: ../Doc/library/re.rst:821 msgid "Match Objects" msgstr "Objets de correspondance" #: ../Doc/library/re.rst:825 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~regex." "match` and :meth:`~regex.search` return ``None`` when there is no match, you " "can test whether there was a match with a simple ``if`` statement::" msgstr "" "Les objets de correspondance ont toujours une valeur booléenne ``True``. " "Puisque :meth:`~regex.match` et :meth:`~regex.search` renvoient ``None`` " "quand il n'y a pas de correspondance, vous pouvez tester s'il y a eu " "correspondance avec une simple instruction ``if`` : ::" #: ../Doc/library/re.rst:834 msgid "Match objects support the following methods and attributes:" msgstr "" "Les objets de correspondance supportent les méthodes et attributs suivants :" #: ../Doc/library/re.rst:839 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~RegexObject.sub` method. Escapes " "such as ``\\n`` are converted to the appropriate characters, and numeric " "backreferences (``\\1``, ``\\2``) and named backreferences (``\\g<1>``, ``" "\\g``) are replaced by the contents of the corresponding group." msgstr "" #: ../Doc/library/re.rst:848 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " "is a tuple with one item per argument. Without arguments, *group1* defaults " "to zero (the whole match is returned). If a *groupN* argument is zero, the " "corresponding return value is the entire matching string; if it is in the " "inclusive range [1..99], it is the string matching the corresponding " "parenthesized group. If a group number is negative or larger than the " "number of groups defined in the pattern, an :exc:`IndexError` exception is " "raised. If a group is contained in a part of the pattern that did not match, " "the corresponding result is ``None``. If a group is contained in a part of " "the pattern that matched multiple times, the last match is returned." msgstr "" "Renvoie un ou plus sous-groupes de la correspondance. Si un seul argument " "est donné, le résultat est une chaîne simple ; s'il y a plusieurs arguments, " "le résultat est un *tuple* comprenant un élément par argument. Sans " "arguments, *group1* vaut par défaut zéro (la correspondance entière est " "renvoyée). Si un argument *groupN* vaut zéro, l'élément associé sera la " "chaîne de correspondance entière ; s'il est dans l'intervalle fermé [1..99], " "c'est la correspondance avec le groupe de parenthèses associé. Si un numéro " "de groupe est négatif ou supérieur au nombre de groupes définis dans le " "motif, une exception :exc:`indexError` est levée. Si un groupe est contenu " "dans une partie du motif qui n'a aucune correspondance, l'élément associé " "sera ``None``. Si un groupe est contenu dans une partie du motif qui a " "plusieurs correspondances, seule la dernière correspondance est renvoyée." #: ../Doc/library/re.rst:870 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " "string argument is not used as a group name in the pattern, an :exc:" "`IndexError` exception is raised." msgstr "" "Si l'expression rationnelle utilise la syntaxe ``(?P...)``, les " "arguments *groupN* peuvent alors aussi être des chaînes identifiant les " "groupes par leurs noms. Si une chaîne donnée en argument n'est pas utilisée " "comme nom de groupe dans le motif, une exception :exc:`IndexError` est levée." #: ../Doc/library/re.rst:875 msgid "A moderately complicated example:" msgstr "Un exemple modérément compliqué :" #: ../Doc/library/re.rst:883 msgid "Named groups can also be referred to by their index:" msgstr "Les groupes nommés peuvent aussi être référencés par leur index :" #: ../Doc/library/re.rst:890 msgid "If a group matches multiple times, only the last match is accessible:" msgstr "" "Si un groupe a plusieurs correspondances, seule la dernière est accessible :" #: ../Doc/library/re.rst:899 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``. " "(Incompatibility note: in the original Python 1.5 release, if the tuple was " "one element long, a string would be returned instead. In later versions " "(from 1.5.1 on), a singleton tuple is returned in such cases.)" msgstr "" #: ../Doc/library/re.rst:906 msgid "For example:" msgstr "Par exemple ::" #: ../Doc/library/re.rst:912 msgid "" "If we make the decimal place and everything after it optional, not all " "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:925 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "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:937 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " "``-1`` if *group* exists but did not contribute to the match. For a match " "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:945 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." "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:950 msgid "An example that will remove *remove_this* from email addresses:" msgstr "Un exemple qui supprimera *remove_this* d'une adresse email :" #: ../Doc/library/re.rst:960 msgid "" "For :class:`MatchObject` *m*, return the 2-tuple ``(m.start(group), m." "end(group))``. Note that if *group* did not contribute to the match, this is " "``(-1, -1)``. *group* defaults to zero, the entire match." msgstr "" #: ../Doc/library/re.rst:967 msgid "" "The value of *pos* which was passed to the :meth:`~RegexObject.search` or :" "meth:`~RegexObject.match` method of the :class:`RegexObject`. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" #: ../Doc/library/re.rst:974 msgid "" "The value of *endpos* which was passed to the :meth:`~RegexObject.search` " "or :meth:`~RegexObject.match` method of the :class:`RegexObject`. This is " "the index into the string beyond which the RE engine will not go." msgstr "" #: ../Doc/library/re.rst:981 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" "(b))``, and ``((ab))`` will have ``lastindex == 1`` if applied to the string " "``'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:990 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:996 msgid "" "The regular expression object whose :meth:`~RegexObject.match` or :meth:" "`~RegexObject.search` method produced this :class:`MatchObject` instance." msgstr "" #: ../Doc/library/re.rst:1003 msgid "" "The string passed to :meth:`~RegexObject.match` or :meth:`~RegexObject." "search`." msgstr "" #: ../Doc/library/re.rst:1008 msgid "Examples" msgstr "Exemples" #: ../Doc/library/re.rst:1012 msgid "Checking For a Pair" msgstr "" #: ../Doc/library/re.rst:1014 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:1024 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " "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:1029 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:1039 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "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:1049 msgid "" "To find out what card the pair consists of, one could use the :meth:" "`~MatchObject.group` method of :class:`MatchObject` in the following manner:" msgstr "" #: ../Doc/library/re.rst:1070 msgid "Simulating scanf()" msgstr "Simuler *scanf()*" #: ../Doc/library/re.rst:1074 msgid "" "Python does not currently have an equivalent to :c:func:`scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" "func:`scanf` format strings. The table below offers some more-or-less " "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:1081 msgid ":c:func:`scanf` Token" msgstr "Élément de :c:func:`scanf`" #: ../Doc/library/re.rst:1081 msgid "Regular Expression" msgstr "Expression rationnelle" #: ../Doc/library/re.rst:1083 msgid "``%c``" msgstr "``%c``" #: ../Doc/library/re.rst:1083 msgid "``.``" msgstr "``.``" #: ../Doc/library/re.rst:1085 msgid "``%5c``" msgstr "``%5c``" #: ../Doc/library/re.rst:1085 msgid "``.{5}``" msgstr "``.{5}``" #: ../Doc/library/re.rst:1087 msgid "``%d``" msgstr "``%d``" #: ../Doc/library/re.rst:1087 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" #: ../Doc/library/re.rst:1089 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" #: ../Doc/library/re.rst:1089 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" #: ../Doc/library/re.rst:1091 msgid "``%i``" msgstr "``%i``" #: ../Doc/library/re.rst:1091 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" #: ../Doc/library/re.rst:1093 msgid "``%o``" msgstr "``%o``" #: ../Doc/library/re.rst:1093 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" #: ../Doc/library/re.rst:1095 msgid "``%s``" msgstr "``%s``" #: ../Doc/library/re.rst:1095 msgid "``\\S+``" msgstr "``\\S+``" #: ../Doc/library/re.rst:1097 msgid "``%u``" msgstr "``%u``" #: ../Doc/library/re.rst:1097 msgid "``\\d+``" msgstr "``\\d+``" #: ../Doc/library/re.rst:1099 msgid "``%x``, ``%X``" msgstr "``%x``, ``%X``" #: ../Doc/library/re.rst:1099 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" #: ../Doc/library/re.rst:1102 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:1106 msgid "you would use a :c:func:`scanf` format like ::" msgstr "vous utiliseriez un format :c:func:`scanf` comme : ::" #: ../Doc/library/re.rst:1110 msgid "The equivalent regular expression would be ::" msgstr "L'expression rationnelle équivalente serait : ::" #: ../Doc/library/re.rst:1118 msgid "search() vs. match()" msgstr "search() vs. match()" #: ../Doc/library/re.rst:1122 msgid "" "Python offers two different primitive operations based on regular " "expressions: :func:`re.match` checks for a match only at the beginning of " "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:1127 msgid "For example::" msgstr "Par exemple ::" #: ../Doc/library/re.rst:1133 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:1141 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "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:1151 msgid "Making a Phonebook" msgstr "Construire un répertoire téléphonique" #: ../Doc/library/re.rst:1153 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " "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:1158 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:1169 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:1182 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "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:1195 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "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:1210 msgid "Text Munging" msgstr "Mélanger les lettres des mots" #: ../Doc/library/re.rst:1212 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " "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:1229 msgid "Finding all Adverbs" msgstr "Trouver tous les adverbes" #: ../Doc/library/re.rst:1231 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if one was a writer and wanted to " "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:1242 msgid "Finding all Adverbs and their Positions" msgstr "Trouver tous les adverbes et leurs positions" #: ../Doc/library/re.rst:1244 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides instances of :class:" "`MatchObject` instead of strings. Continuing with the previous example, if " "one was a writer who wanted to find all of the adverbs *and their positions* " "in some text, he or she would use :func:`finditer` in the following manner:" msgstr "" #: ../Doc/library/re.rst:1258 msgid "Raw String Notation" msgstr "Notation brutes de chaînes" #: ../Doc/library/re.rst:1260 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " "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:1270 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " "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 :"