updated regex

if opts[:allow_empty] is true then the input can contain any string
 or none at all