You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
brett treweek
brett-treweek
Studied Full Stack Web Development at University of Western Australia.
Tutorial on using regex to validate Hexadecimal Color Codes.
Using Regular Expressions to validate Hexadecimal Color Codes in Javascript.
When first introduced to regular expressions (or regex) in programming they may seem confusing and cryptic. Despite this, they are very useful. They allow for fast validation of any string value, and identification of specific string values within code or text. The regex syntax has various 'flavours' across many programming languages, database software and text editors, yet the principles are the same. Click here for a great resource on Regular Expressions Click here for a great resource on HEX color codes
Summary
This tutorial will describe a commonly used and useful regex that can validate Hexadecimal Color Codes.