Deutsch English Français Italiano |
<tj3fco$b2h$1@shakotay.alphanet.ch> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail From: Marc SCHAEFER <schaefer@alphanet.ch> Newsgroups: fr.comp.lang.regexp Subject: Re: Extraction nombre =?ISO-8859-1?Q?d=E9cimaux=2E?= Supersedes: <tj3eq4$90q$1@shakotay.alphanet.ch> Date: Sun, 23 Oct 2022 13:25:44 -0000 (UTC) Organization: Posted through news.alphanet.ch Message-ID: <tj3fco$b2h$1@shakotay.alphanet.ch> References: <635501d4$0$22259$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 23 Oct 2022 13:25:44 -0000 (UTC) Injection-Info: shakotay.alphanet.ch; posting-account="schaefer"; logging-data="11345"; mail-complaints-to="usenet@alphanet.ch"; posting-host="634ce6c9682d817d72f6177875e2bb4f.nnrp.alphanet.ch" User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-22-amd64 (x86_64)) Cancel-Key: sha256:n7CIbjHe/dBHiBmYE+RsBAUAp6PbCeiG5KVpBYE50Ug= Cancel-Lock: sha256:wL2UQVMEI+TmT11C4zeTdUZNmzNhBoPAnQe9uN5RdKI= sha256:uXLNmVzHl2X3/X5JB7ckwlfRA3vibfSJbJL+3iKiUb4= Bytes: 1741 Lines: 30 kurtz le pirate <kurtzlepirate@free.fr> wrote: > @floatnum = $line =~ /[-+]?([0-9]*\.[0-9]+|[0-9]+)/g; comme [-+]? n'est pas entre (), Perl ne va pas l'extraire et il ne va pas finir dans le tableau. @floatnum = $line =~ /([-+]?[0-9]*\.[0-9]+|[0-9]+)/g; démo: schaefer@reliand:/tmp$ ./a.pl 1.2 1.2 1.2 4.5 1.2, 4.5 -1.2 -1.2 -1.2 4.5 -1.2, 4.5 schaefer@reliand:/tmp$ cat a.pl #! /usr/bin/perl use strict; use warnings; while (my $line = <STDIN>) { my @f = $line =~ /([-+]?[0-9]*\.[0-9]+|[0-9]+)/g; print join(', ', @f), "\n"; }