C# - Regular expression for validating Hex Color Codes.

By [)ia6l0 iii

Use the regex below for validating hexadecimal color code. It ensures that the value starts with a # and has valid 3/6 alphanumeric codes. You can use the same script in Javascript as well.

^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

Related FAQs

Use the Environment class to get important and user-specific properties like the User Profile folder.
There is no File.Rename method in C#. Use the System.IO.File.Move method instead.
Extension method to get the start of a day
Use the GetCommandLineArgs static method of the Environment class. It returns an array of the arguments.
You can truncate the file paths using the Shell LightWeight library.
Extension method to get the elasped time
C# - Regular expression for validating Hex Color Codes.  (2813 Views)