-2

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.
user732853
  • 481
  • 1
  • 4
  • 7

2 Answers2

2

try

var regex = new Regex(@"^AA[a-zA-Z]+-[0-9]+$");
Bala R
  • 107,317
  • 23
  • 199
  • 210
1
@"^AA[A-Za-z]+[-]\d+$"

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

BrunoLM
  • 97,872
  • 84
  • 296
  • 452