Regular Expression

Posted by Kartheekbabu.a under JavaScript on 8/4/2009 | Views : 1140 | Status : [Member] | Replies : 4
Hi i want the regular expression like only numeric values starts with 1 to 99 and only allow 1,1.5,2,2.5,3,3.5 etc ..
can any one plz help ..

Thanks in advance

Kartheek babu.




Responses

Posted by: perfectchourasia-9163 on: 11/17/2011 [Member] Starter | Points: 25

Up
0
Down
http://asp.net-tutorials.com/validation/regular-expression-validator/

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Kartheekbabu.a, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Poster on: 8/5/2009 [Member] Starter

Up
0
Down
Look for this page and hopefully you will get the solution.

http://regexlib.com/Search.aspx?k=numeric+&c=3&m=-1&ps=20

Thanks

Kartheekbabu.a, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 9/28/2009 [Member] [MVP] Bronze

Up
0
Down
I think that would look like this:

^[1-9]{1,2}(.5)?$

To break that down it would be:

^ - match start of line (nothing can come before it)
[1-9] - match a numeric digit from 1-9 (you could also use \d but that would allow a 0)
{1,2} - require one or two digit number
(.5)? - the group () of text .5, and ? is zero or one occurances
$- match end of string (nothing can come after it)


Yeah I just tested this on regexlib tester and it seems to only allow valid patterns.

I am going to post it up on there for others to use...

Kartheekbabu.a, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 9/28/2009 [Member] [MVP] Bronze

Up
0
Down
I have posted the regex here for future reference:

http://www.regexlib.com/REDetails.aspx?regexp_id=2784

Kartheekbabu.a, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response