validate pattern for primitive values