© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
121 replies
Mek

✅ Learning Regex

string errorText = "Username Must Be Created Using The Letters A-Z, a-z, 0-9, or special characters !@#$%^&*";
string regex = // something here
string username = ColorCon.GetStringFromConsole(
  prompt: "Create A Username:",
  color: ConsoleColor.White,
  validator: x => x.IsMatch(regex),
  errorMessage: errorText);
string errorText = "Username Must Be Created Using The Letters A-Z, a-z, 0-9, or special characters !@#$%^&*";
string regex = // something here
string username = ColorCon.GetStringFromConsole(
  prompt: "Create A Username:",
  color: ConsoleColor.White,
  validator: x => x.IsMatch(regex),
  errorMessage: errorText);
I've never learned to create regex strings for validation, and I'm wanting to learn how to use/create them. I've used them before, but it was just a mere "<something_here> regex validation" on google, copy/paste and go.
1. What is a regex string
2. How do I write them to get the format that I'm wanting?
3. For this specific purpose, the username should be able to be something like
someUsername
someUsername
,
some$Username
some$Username
, or
SomEU123sername!$
SomEU123sername!$
Thanks
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

Regex help.
C#CC# / help
11mo ago
Regex conditional
C#CC# / help
3y ago
❔ Smart Regex
C#CC# / help
3y ago
❔ REGEX help!
C#CC# / help
3y ago
Next page