Deutsch   English   Français   Italiano  
<tdcrm0$36k$1@gioia.aioe.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!news.mixmin.net!aioe.org!5Yudd+uVLKhAaFqBS6SS8w.user.46.165.242.91.POSTED!not-for-mail
From: Dominique <zzz@aol.com>
Newsgroups: fr.comp.lang.regexp
Subject: =?UTF-8?Q?Re=3a_Variantes_chiffres/r=c3=a9p=c3=a9titions_=28was=3a_?=
 =?UTF-8?Q?Aide_Utomator=29?=
Date: Mon, 15 Aug 2022 09:13:04 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tdcrm0$36k$1@gioia.aioe.org>
References: <PtWdnYKMErJdh2j_nZ2dnZfqlJ_NnZ2d@giganews.com>
 <Wt6dnX_CDfcwOGv_nZ2dnZfqlJzNnZ2d@giganews.com>
 <td7s62$9ss$3@shakotay.alphanet.ch>
 <130820221715349823%Kuypers@address.invalid> <tdahbl$34au1$2@dont-email.me>
 <tdaipl$1t5g$1@cabale.usenet-fr.net> <tdck2h$1ucj$1@gioia.aioe.org>
 <tdcqe4$2e9s$1@cabale.usenet-fr.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="3284"; posting-host="5Yudd+uVLKhAaFqBS6SS8w.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.1.2
Content-Language: fr
X-Notice: Filtered by postfilter v. 0.9.2
Bytes: 2706
Lines: 46

Le 15/08/2022 à 08:51, Olivier Miakinen a écrit :
> Bonjour,
> 
> Le 15/08/2022 à 07:03, Dominique a écrit :
>>
>> J'ai toujours recherché des chiffres avec [0-9]{1,}( comme dans LibreOffice)
>>
>> Voici un exemple en Pythom avec la librairie re :
>>
>> modele1='[0-9]{1,3}[:][0-9]{2}[:][0-9]{2}'
>> modele2='[0-9]{1,3}[:][0-9]{2}[.][0-9]{1,}'
>>
>> Là, je vérifie la bonne saisie d'un angle ou d'une heure en ddd:mm:ss ou
>> ddd:mm.mmmmm
>>
>> Ça fonctionne très bien, mais est-ce correct ?
> 
> Oui, en tout cas avec les regexp de type perl qui sont les plus avancées
> on a déjà les équivalences suivantes :
>   {1,}  == +
>   {0,}  == *

Je ne comprends pas bien ces deux lignes. Pour moi {1,} veut dire 1 ou 
plus et {0,} veut dire rien ou plus. Je dois me tromper.

> 
> C'est le cas en Python : <https://docs.python.org/3/library/re.html>
> 
> Mais là où tu as absolument raison, c'est que dans un programme qui
> pourrait être sensible et éventuellement sujet à une attaque par un
> pirate, il est mille fois préférable d'écrire [0-9] plutôt que \d :
> 
> <https://docs.python.org/3/library/re.html>
> §
>   \d
> 
>   For Unicode (str) patterns:
> 
>   Matches any Unicode decimal digit (that is, any character in Unicode
>   character category [Nd]). This includes [0-9], and also many other
>   digit characters. If the ASCII flag is used only [0-9] is matched.
> §
> 
> 

Un grand merci pour tes précisions.