Allow values based on number (@jsvk)

With lots of help from @jsvk.
Can you cache the rgx similar to line 14?