Matches CSS hex color codes like #fff or #ffffff.
/#(?:[0-9a-fA-F]{3}){1,2}\b/g
const regex = /#(?:[0-9a-fA-F]{3}){1,2}\b/g; const result = str.match(regex);
import re pattern = re.compile(r'#(?:[0-9a-fA-F]{3}){1,2}\b') result = pattern.findall(text)
import "regexp" re := regexp.MustCompile(`#(?:[0-9a-fA-F]{3}){1,2}\b`) result := re.FindAllString(text, -1)