Click here to Skip to main content
15,883,918 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
how to change this regular expession to must have two decimal place



HTML
((0)+(\.[1-9](\d)?))|((0)+(\.(\d)[1-9]+))|(([1-9]+(0)?)+(\.\d+)?)|(([1-9]+(0)?)+(\.\d+)?) 


cause i try 0.0123 it work but if i try 1.123 it don't wok, if i try 0.1 is don't work

i have try this [0-9]+\.[0-9][0-9](?:[^0-9]|$) it work al above what i mention, but i doesnt work for 0.00
so i have this text box and a regularexpressionvalidator, how should i check against 0.00?
Posted
Updated 2-Feb-12 18:41pm
v2

Do you mean that you must have at least two decimals. Perhaps something like:
\d{1}.(\d){2,32}
 
Share this answer
 
Comments
cutexxbaby 3-Feb-12 0:41am    
[0-9]+\.[0-9][0-9](?:[^0-9]|$) it work al above what i mention, but i doesnt work for 0.00
so i have this text box and a regularexpressionvalidator, how should i check against 0.00?
cutexxbaby 3-Feb-12 0:42am    
plus if the expression you give dont allow me 0.01 or 0.10
Wendelius 3-Feb-12 1:01am    
Don't quite understand, when I tested it, 0.01 matches the expression just fine
LanFanNinja 3-Feb-12 1:03am    
Don't know if this will help you but it helped me out a while back.
Regex for 0.00
Check this similar post,

SOF[^]

Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900