Regular Expression for percents (with % sign) in ASP.Net RegEx Validator -


i need regex asp.net (4) regex validation control. needs regex validator support other dynamic behaviors outside scope of post..

i using following, fails if user enters % sign following number (which req of spec):

^(100(?:\.0{1,2})?|0*?\.\d{1,2}|\d{1,2}(?:\.\d{1,2})?)$ 

i tried adding atomic group of ^(?>%?) @ end, no luck, after reading excellent post

regular expression greedy match not working expected

does have ideas?

many thanks,

-jay

try this

^(100(?:.0{1,2})?%?|0*?.\d{1,2}%?|\d{1,2}(?:.\d{1,2})?%?)$ 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -