Skip to content
Advertisement

Tag: hex

Need help figuring out how to write this Regex properly

I am trying to make a regex test that returns true for the following conditions: Can only have letters A-F (case insensitive) First character must be ‘#’ Can have numbers 0-9 Does not have punctuation The order does not matter except that string[0] should be ‘#’. So far I have: /^#[A-F0-9^!G-Z]/i but for some reason, it returns strings that have

Advertisement