gsdevEE
asked on
Regex for 12 alphanumeric characters, a dash "-", and 1 to 12 characters in length, including whitespace
Regex for 12 alphanumeric characters, a dash "-", and 1 to 12 characters in length, including whitespace.
So abc-12345678 would be valid
abc-123456789 would be invalid
And any string including any characters other than these would be invalid.
I cant figure the regex out. Im sure there is someone who can get this quick, and I have too many bugs on my plate - thanks !
C#
So abc-12345678 would be valid
abc-123456789 would be invalid
And any string including any characters other than these would be invalid.
I cant figure the regex out. Im sure there is someone who can get this quick, and I have too many bugs on my plate - thanks !
C#
Hello gsdevEE,
Would the following be valid:
----
1234
abcd
They all meet the written criteria, but look somewhat different from your only example of a valid code...
Regards,
Patrick
Would the following be valid:
----
1234
abcd
They all meet the written criteria, but look somewhat different from your only example of a valid code...
Regards,
Patrick
elimesika,
I think you meant:
[a-zA-Z0-9 -]{1,12}
:)
Patrick
I think you meant:
[a-zA-Z0-9 -]{1,12}
:)
Patrick
Hi gsdevEE;
This regex pattern should do what you want.
Fernando
This regex pattern should do what you want.
Fernando
^[a-zA-Z0-9-]{1,12}$
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window