Add pattern attribute to input element