RE: Regex 101 Exercise S2 - Verify a string is a hex number

Eric Gunnerson Ask a Question about a simple question about Regular Expressions:

Welcome to week #2 of our class. This is a simple one:

S2 - Verify a string is a hex number

Given a string, verify that it contains only the digits 0-9 and the letters a through f (either in uppercase or lowercase).

Answer/discussion on Friday…


[Via MSDN Blogs]

My answer for this would have to be


However I know that it means that you can start a number with a 0 which may or may not be what he wants.

  1. A-Fa-f0-9 [return]

Paul Kinlan

Trying to make the web and developers better.

RSS Github Medium