Sean Killeen bio photo

Sean Killeen

Just a guy trying to get better at writing bios.

Email Twitter Facebook Google+ LinkedIn Instagram Github Stackoverflow Foursquare
Edit this page | Issue? Question?

This one’s mostly for my quick personal reference. It wasn’t hard by any means but figured someone else might find it useful.

Problem

I need to find all hex color codes in a style sheet so I can extract them.

Solution

I came up with a quick Regex (regular expression) to do this:

#([A-Fa-f0-9]*);

Essentially, it just looks for a pound symbol (#), followed by any amount of numbers 0-9 or letters a-f, followed by a semi-colon.

If you’re interested to try it, you can view my example over at Regex Tester.

It’s not the slickest but it got the job done quickly.

Happy coding!