I’m looking for a regular expression to validate hex colors in ASP.NET C# and
am also looking code for validation on server side.
For instance: #CCCCCC
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: This is strictly for validation, i.e. accepting a valid hex color. For actual parsing you won’t get the individual parts out of this.
For ARGB:
Dissection:
This will match an arbitrary hexadecimal color value that can be used in CSS, such as
#91bf4aor#f13.