Deutsch   English   Français   Italiano  
<635501d4$0$22259$426a74cc@news.free.fr>

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

Path: ...!news.mixmin.net!aioe.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-b.proxad.net!nnrp4-1.free.fr!not-for-mail
Newsgroups: fr.comp.lang.regexp
X-Mozilla-News-Host: news://news.free.fr:119
From: kurtz le pirate <kurtzlepirate@free.fr>
Subject: =?UTF-8?Q?Extraction_nombre_d=c3=a9cimaux=2e?=
Organization: Compagnie de la Banquise
Date: Sun, 23 Oct 2022 10:56:52 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:78.0)
 Gecko/20100101 Thunderbird/78.14.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: fr
Content-Transfer-Encoding: 8bit
Lines: 45
Message-ID: <635501d4$0$22259$426a74cc@news.free.fr>
NNTP-Posting-Date: 23 Oct 2022 10:56:52 CEST
NNTP-Posting-Host: 81.249.98.47
X-Trace: 1666515412 news-3.free.fr 22259 81.249.98.47:49499
X-Complaints-To: abuse@proxad.net
Bytes: 1891


Bonjour,

Je troune en rond depuis quelques temps sur l'extraction de nombre
décimaux depuis un fichiers. je n'arrive pas à capturer le signe.

Le bout de code :

my $countLine = 1;
my @floatnum;
foreach my $line (<SRCFILE>) {
  chomp $line;
  printf("%4d : %s\n", $countLine, $line);
  @floatnum = $line =~ /[-+]?([0-9]*\.[0-9]+|[0-9]+)/g;
# @floatnum = $line =~ /($RE{num}{real})/g;
# @floatnum = $line =~ /([+-]?\d+(\.\d+)?)/g;
  if (@floatnum) {
    print "float = $_\n" foreach (@floatnum);
    }
  $countLine++;
  }

Surtout (!) pour les nombres négatifs.
Le "+" pour les nombres positifs n'existe jamais.


Exemple :
#declare x = -.168452; #declare y = 0.456; #declare z = -5.4563e6;

Je récupère :
float = .168452
float = 0.456
float = 5.4563
float = 6


Pas de signe.
Faut aussi que je m'occupe des exposants mais après ...


Merci pour vos suggestions.

-- 
kurtz le pirate
compagnie de la banquise