Regular Expressions (Regex) to allow both decimals as wells as integers in C#

Smith
Smith
Participant
374 Points
112 Posts

I am trying to validate a number that may be decimal number decimal(19,2) or a integer value as 

  • 10
  • 10.1
  • 10.12
  • 0

I want to do with regex  in C#.

Thanks..

Views: 8185
Total Answered: 1
Total Marked As Answer: 0
Posted On: 18-May-2016 00:38

Share:   fb twitter linkedin
Answers
Mayank
Mayank
Member
78 Points
24 Posts
         

Hi,

try following regex as

\d+(\.\d{1,2})?
Posted On: 18-May-2016 00:44
 Log In to Chat