?
Solved

Regular Expression For Color Validation

Posted on 2006-05-30
2
Medium Priority
?
642 Views
Last Modified: 2008-01-09
I'm looking for a regular expression to validate hex colors.  Unfortunetly, I know little about regex.

 For instance:    #CCCCCC

500 points to the person who helps me solve this quickly.

Thanks

Phil
0
Comment
Question by:SiriusPhil
2 Comments
 
LVL 10

Accepted Solution

by:
0h4crying0utloud earned 2000 total points
ID: 16795056

here ya go: #[a-fA-F0-9]{6}


in javascript:
yourString.match(/#[a-fA-F0-9]{6}/)
0
 

Author Comment

by:SiriusPhil
ID: 16795260
Perfect... Thanks

Phil
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question