© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•15mo ago•
32 replies
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ help with regex
C#CC# / help
4y ago
❔ Help with simple regex
C#CC# / help
4y ago
Regex help.
C#CC# / help
11mo ago
❔ REGEX help!
C#CC# / help
3y ago