+ 3
create Regular Expression that matches any word just alphabets and also the one for hex color code
Regular Expression with Javascript
4 Antworten
+ 7
Hex: '(^#[a-fA-F0-9]{3}$)|(^#[a-fA-F0-9]{6}$)' (made in Python, might look slightly different in JS)
+ 7
Javascript Version:
Hex Only Pattern:
const pattern = /#[a-f\d]{6}/i;
Word or Hex Pattern:
const pattern = /^(#[a-f\d]{6}|[a-z]+(?=(\s|$)))/i;
See tests in this link.
https://regex101.com/r/uvpDxO/4
+ 4
any characters would be: (a-z | A-Z)*
hex colour code would be: ^#(0-9 | A-F){6}
I think anyways, been a while since I've used RegEx.
+ 3