Custom validation with fix value pattern

Hi,

In my model I have a column called "special_code" that get input values from textfield form. The pattern for input values is always conform to *n1n2 where n1 and n2 is a digit. Valid value examples: *00, *99. Invalid values examples: 88, *123, etc. What is the correct way to specify this custom validation rule in my model? Thank you!

Hi,

you have to use pattern validation … Just refer documentation for inbuild validation. There is a validation for patter.

Thank you Chandran, here is the validation rule I came up with:

array(special_code’, ‘match’, ‘pattern’=>’/^([*][0-9][0-9])+$/’)

Hope it helps someone too!