Regular expression to match a percentage with decimal?

前端 未结 3 637
你的背包
你的背包 2020-12-20 07:01

I\'m attempting to build a regular expression (.NET) to match a percentage with 4 decimal places. The 4 decimal places are required. The range looks like:

0.         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-20 07:30

    I would do something like this:

    ^((([0-9]|[1-9]\d)\.\d{4})|100\.0000)$
    

    Proof

提交回复
热议问题