Regular Expressions 101

Community Patterns

Hex Color Code

0

Regular Expression
Python

r"
(?P<Hex>(?<=.[^}{])#(?:[\dA-F]{6}|[\dA-F]{3})(?=\W[^}{]))+
"
ig

Description

A solution of this test from HackerRank

https://www.hackerrank.com/challenges/hex-color-code/problem

Submitted by anonymous - 2 years ago