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

Paul Kinlan

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…

[[posterous-content:uBElaDAHtglzaibhbbqx]]

[Via MSDN Blogs]

My answer for this would have to be

1*$

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