regex validation works for length-zero patterns.