math regex

[email protected] ("Dmitriy A. Kuvshinov")
Newsgroups perl.golf
Message-ID <[email protected]>
Greetings from Moscow!

I have written the regex for selection of numbers in
"mathematical recording", whether it is possible to
make its length some more smaller?

#!/usr/bin/perl
$_=qq~
1234
34 -4567
 3456
-0.35e-0,2
    56grf45
-.034 E20
     -.034 e2,01   -,045 e-,23
  -,034 e201  3e-.20
-,045 e-,23 e-0.88

4 E-0.20
22
E-21
 -0.2 w         4 3
345
2 ^-,3
~;

print "$1\n" while m%(([+-]?(?=\d|[\.,]\d)\d*([\.,]\d*)?((\se|e|\s?\^)
    ([-+]?\d*[,\.]?)\d+)?)|([+-]?e[+-]?\d*[,.]?\d+))%gxi;



dmitriy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.