We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Regex and Parsing
- Hex Color Code
- Discussions
Hex Color Code
Hex Color Code
+ 0 comments import re for _ in range(int(input())): s = input() if re.search(r'^\s.*(#[\da-fA-F]{3,6})', s): print(*re.findall(r'#[\da-fA-F]{3,6}', s), sep='\n')
+ 0 comments import re for i in range(int(input())): [print(match[0]+match[1]) for match in re.findall(r'([#]{1})([0-9a-fA-F]{3,6})([;,\\)])', input())]
+ 0 comments import re for _ in range(int(input())): for i in re.findall(r'(?<=[ :,])#[0-9A-Fa-f]{3,6}', input()): print(i)
+ 0 comments There is a tab/whitespace (\s) at the beginning of the line having HEX :
import re for _ in range(int(input())): s = input() if re.search(r'^\s.*(#[\da-fA-F]{3,6})', s): print(*re.findall(r'#[\da-fA-F]{3,6}', s), sep='\n')
+ 0 comments python3
s='''''' for _ in range(int(input())): s=s+input()+'\n' mat = re.findall(r'#[a-fA-F0-9]{3,6}\s{0,}[,);]',s) for i in mat: if ';' or ',' or ')' or '\n' in i: a=i.strip(";),\n") print(a)
Load more conversations
Sort 309 Discussions, By:
Please Login in order to post a comment