Added input catching on the pattern field.