Thanks:  0
Likes:  0
Dislikes:  0

# Thread: Regular expression for 0 to 99.99

1. ## Regular expression for 0 to 99.99

Hi,

I need a regular expression for a number which takes 0 to 99.99.

Ex: 0, 1.1, 5.55,19,20.1,88.99

Regards,
Srinivas.V

2. ## Re: Regular expression for 0 to 99.99

Try this:

"[0-9]{1,2}\.[0-9]{1,2}|[0-9]{1,2}

3. ## Re: Regular expression for 0 to 99.99

Oops! That's what I get for posting a non-tested suggestion:

------------------------------------------------------------

Without testing this suggestion, I think that:

from: [0-9\.].* (has error syntax)
to: [0-9\.]*

will provide a "sloppy" match. By sloppy I mean that it will match any combination of digits and periods, not just 0 to 99.99.

Anyway you can give this a try and if it does work, or does not meet your needs then refer to the "Regular Expression Syntax" entry in online HELP.

4. ## Re: Regular expression for 0 to 99.99

"^([0-9]{1,2}(\.[0-9]{1-2})?)\$"

5. ## Re: Regular expression for 0 to 99.99

[ QUOTE ]
"^([0-9]{1,2}(\.[0-9]{1-2})?)\$"

[/ QUOTE ]

I think it should be like this.

"^([0-9]{1,2}(\.[0-9]<font color="blue">{1,2} </font>)?)\$"

6. ## Re: Regular expression for 0 to 99.99

[ QUOTE ]
[ QUOTE ]
"^([0-9]{1,2}(\.[0-9]{1-2})?)\$"

[/ QUOTE ]

I think it should be like this.

"^([0-9]{1,2}(\.[0-9]<font color="blue">{1,2} </font>)?)\$"

[/ QUOTE ]

Thanks for correcting TReddy.

(Just removed the extra space)
"^([0-9]{1,2}(\.[0-9]<font color="blue">{1,2}</font>)?)\$"

7. ## Re: Regular expression for 0 to 99.99

Oops, the extra space got inserted when I was inserting html tag for color. [img]/images/graemlins/wink.gif[/img]

8. ## Re: Regular expression for 0 to 99.99

Oops is a major keyword when working with regular expressions!

9. ## Re: Regular expression for 0 to 99.99

[ QUOTE ]
Oops is a major keyword when working with regular expressions!

[/ QUOTE ]

Terry, you are very true. [img]/images/graemlins/smile.gif[/img]

10. ## Re: Regular expression for 0 to 99.99

[ QUOTE ]
Terry, you are very true. [img]/images/graemlins/smile.gif[/img]

[/ QUOTE ]

True is also a keyword [img]/images/graemlins/wink.gif[/img]

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.