M
mdfoster44
Hi,
I'm trying to upload some data into a MySQL database.
Could someone please advise me how I handle scientific notation?
What I have sofar:
-------
The data (pt, x)
P1 4.50015068000000D-004
-------
My regex expressions, I've been experimenting with:
regex1: P\d+\s+(-?([0-9]+(\.[0-9]*)?|\.[0-9]+))/)
does not catch the scientific notation
regex2: P\d+\s+([+-]?(\d+(\.\d*)?|\.\d+)([eEdD][+-]?\d+))/)
does catch the scientific notation. I then say,
$number = $1;
-------
# Insert data
$dbh->do("INSERT INTO data(x) VALUES (?)",undef, $number);
-------
How do I upload the number to the database? If I do it as above it is
incorrect.
Thanks your help.
Martin.
I'm trying to upload some data into a MySQL database.
Could someone please advise me how I handle scientific notation?
What I have sofar:
-------
The data (pt, x)
P1 4.50015068000000D-004
-------
My regex expressions, I've been experimenting with:
regex1: P\d+\s+(-?([0-9]+(\.[0-9]*)?|\.[0-9]+))/)
does not catch the scientific notation
regex2: P\d+\s+([+-]?(\d+(\.\d*)?|\.\d+)([eEdD][+-]?\d+))/)
does catch the scientific notation. I then say,
$number = $1;
-------
# Insert data
$dbh->do("INSERT INTO data(x) VALUES (?)",undef, $number);
-------
How do I upload the number to the database? If I do it as above it is
incorrect.
Thanks your help.
Martin.