-6

I need couple of regular expression in ASP.NET.

  1. First should accept only 6 characters and second and third character should accept only _ (underscore).

    Like: a__cde

  2. And I want one other regex that should also take 6 characters and at second position it should accept only underscore (_) and at third position it should accept maybe underscore (_) or hash (#) and at fourth position it should accept only hash (#).

Note: In both the regex user can only enter: Number, Alphabets or Star (*) at any position instead of above mentioned positions.

Can any one help me out on this? I have tried by below website:

http://www.regexr.com/

But not able to generate proper regex.

Biffen
  • 6,249
  • 6
  • 28
  • 36
user3848036
  • 169
  • 2
  • 6
  • 17

1 Answers1

-1

Try something like:

1. ^[a-zA-Z0-9\*]__[a-zA-Z0-9\*]{3}$
2. ^[a-zA-Z0-9\*]_[_#]#[a-zA-Z0-9\*]{2}$
SMA
  • 36,381
  • 8
  • 49
  • 73