Make regular expression case insensitive in ASP.NET RegularExpressionValidator

后端 未结 5 2001
暗喜
暗喜 2020-11-27 19:40

Given this regular expression: \"^[0-9]*\\s*(lbs|kg|kgs)$\" how do I make it case insensitive? I am trying to use this in a .net regular expression validator,

5条回答
  •  渐次进展
    2020-11-27 20:05

    Easiest here is to just modify the regex to

    ^[0-9]*\s*([lL][bB][sS]|[kK][gG][sS]?)$
    

    It's awful to read, but it will work fine.

提交回复
热议问题