开发者

How to make regular expression for this in c#? [closed]

开发者 https://www.devze.com 2023-03-02 14:13 出处:网络
开发者_StackOverflow中文版 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation th
开发者_StackOverflow中文版 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I have a expression, i need to validate. I wanna do it using regular expression. Please help.

  1. AAsswwww-11233 (First 2 char are static - then any alphabets only - then hyphen - then only digits.


try

var regex = new Regex(@"^AA[a-zA-Z]+-[0-9]+$");


@"^AA[A-Za-z]+[-]\d+$"

Learn How to Use and Get The Most out of Regular Expressions

0

精彩评论

暂无评论...
验证码 换一张
取 消