0.01 to 99.99 in a regular expression

Simon Hlavac

New Member
I'm trying to do a regular expression that'll allow numbers from 0.01 to 99.99, but not 0.0 or any null value (00.00 or 00.0 or 0.00 or 0.0) or negative value either.I've come quite close, but as usual something just isn't right. 0.0 shows as valid. Can you please help me fix this.Also, you don't need to keep the expression I've done :) \[code\]<?phpif (preg_match('/^[0-9]{1,2}[\.][0-9]{1,2}$/','0.0')){echo "Valid";}else{echo "Invalid";}?>\[/code\]
 
Back
Top