-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
  • 441
  • 1
  • 4
  • 7

2 Answers2

2

try

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

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

BrunoLM
  • 94,090
  • 80
  • 289
  • 441