en.javascript.info/9-regular-expressions/07-regexp-quantifiers/2-find-html-colors-6hex/task.md
2019-04-02 14:01:44 +03:00

410 B

Regexp for HTML colors

Create a regexp to search HTML-colors written as #ABCDEF: first # and then 6 hexadimal characters.

An example of use:

let reg = /...your regexp.../

let str = "color:#121212; background-color:#AA00ef bad-colors:f#fddee #fd2 #12345678";

alert( str.match(reg) )  // #121212,#AA00ef

P.S. In this task we do not need other color formats like #123 or rgb(1,2,3) etc.