> So I get:
>
> /^-?(?:\d+\.?\d*|\.\d+)$/
I'm being thrown by the ?:
What's that all about?
R.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
"
By Tom Christiansen, Nathan Torkington
2nd Edition August 2003
ISBN: 0-596-00313-7
964 pages, $49.95 US, $77.95 CA, £35.50 UK
-Original Message-
From: Motter, Jeffrey D [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 01, 2004 1:40 PM
To: Perl-Win32-Users
Subject: Regular expression to t
Title: RE: Regular expression to test for numeric values
use Scalar::Util;
if (Scalar::Util::looks_like_number $num)
{
print "Yes, $num is a number\n";
}
else
{
print "no.\n";
}
... found it with perldoc -q number, which also showed a number of rege
Gerber, Christopher J wrote, on Thursday, April 01, 2004 2:12 PM
: -Original Message-
: My guess is that I need a regex that will match on any character that is:
: not 0-9
: or
: more than one "."
: or
: more than one "-"
: or if "-" is not the fir
-Original Message-
My guess is that I need a regex that will match on any character that is:
not 0-9
or
more than one "."
or
more than one "-"
or if "-" is not the first character of the string
Any ideas? Is it possible to do without usi
-Users
Subject: Regular expression to test for numeric values
I've read the FAQ's on this, but they don't seem to answer the question.
I have a variable that could contain any value( alpha, alpha-numeric, or
numeric). If the value is NOT numeric, I need to change the variables'
I've read the FAQ's on this, but they don't seem to answer the question.
I have a variable that could contain any value( alpha, alpha-numeric, or
numeric). If the value is NOT numeric, I need to change the variables' value
to "0"( as in zero ).
Examples:
$txtype="2.314"; # is numeric, so keep t