|
-
Feb 22nd, 2007, 09:40 AM
#1
Thread Starter
Frenzied Member
Regular Expression: Non negative real
I'm stumped.
Can anyone give me the regular expression for testing a string to see if it's a non negative real?
ie
0.000 F
0.001 T
0.101 T
1.000 T
1.111 T
There is no fixed length to the decimal part, either.
Many thanks,
M
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Feb 22nd, 2007, 09:46 AM
#2
PowerPoster
Re: Regular Expression: Non negative real
If csng(field) > 0 then
endif
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Feb 22nd, 2007, 09:47 AM
#3
Thread Starter
Frenzied Member
Re: Regular Expression: Non negative real
 Originally Posted by Pasvorto
If csng(field) > 0 then
endif
Thanks for the quick reply, but that's not a regular expression.
For instance, a non-negative integer can be matched using '^-{0}[0-9]+$' which denotes the set of integers 0,1,2,3,4 . . .n
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Feb 22nd, 2007, 10:34 AM
#4
Re: Regular Expression: Non negative real
Just add a decimal point and any number of integers, in that order, to the right end. I'm a bit rusty at Regex, but I think it would be ^-{0}d+\.d+$
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 22nd, 2007, 10:39 AM
#5
Thread Starter
Frenzied Member
Re: Regular Expression: Non negative real
Thanks.
The '^-{0}\d+\.\d+$' expression does evaluate reals, but does not exclude 0.0
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|