+ 3

create Regular Expression that matches any word just alphabets and also the one for hex color code

Regular Expression with Javascript

16th Jun 2019, 2:52 AM
Devvie
Devvie - avatar
6 odpowiedzi
+ 7
Hex: '(^#[a-fA-F0-9]{3}$)|(^#[a-fA-F0-9]{6}$)' (made in Python, might look slightly different in JS)
16th Jun 2019, 5:47 AM
Anna
Anna - avatar
+ 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
16th Jun 2019, 6:51 AM
David Carroll
David Carroll - avatar
+ 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.
16th Jun 2019, 4:16 AM
Jackson O’Donnell
16th Jun 2019, 11:21 PM
Devvie
Devvie - avatar