C#C
C#13mo ago
NeRooN

Help with a regex

im not good with regex, tried GPT but his brain is not braining. How can i do a regex for:
  • minimum 1 letter to maximum 10 letters in any position
  • minimum 1 digits to maximum 10 digits in any position
  • can include - and _ but will never start or end with those symbols and it will never count in the 10+10 characters count
So this would be valid:

ABCD1234
A1B2C3D4
A_1_b23-Fca
ABCDEFGHIJ1234567890
AB_CDE_FGHIJ-123456_789_0
A1B2C3D4E5F6G7H8I9J0
A1_B2C_3D4E5-F6G7H8I_9J0

i think you get it
Was this page helpful?