I am creating a form, with warning elements. All works great but need to define my patterns better.
$("#postcode").inputNotes(
{
warning: {
pattern: /^[0-9]+$/,
type: 'note',
text: 'Only numbers, please ...',
inversedBehavior: true
}
}
);
$("#phone").inputNotes(
{
warning: {
pattern: /^[0-9]+$/,
type: 'note',
text: 'Only numbers, no spaces please ...',
inversedBehavior: true
}
}
);
Ok for the Postcode warning, I want the pattern to expect 4 numbers
For the Phone warning, I want the pattern to expect 10 numbers.
Any help appreciated.
Here are the rules for Australian postcodes:
ACT: 0200-0299 and 2600-2639.
NSW: 1000-1999, 2000-2599 and 2640-2914.
NT: 0900-0999 and 0800-0899.
QLD: 9000-9999 and 4000-4999.
SA: 5000-5999.
TAS: 7800-7999 and 7000-7499.
VIC: 8000-8999 and 3000-3999.
WA: 6800-6999 and 6000-6799
Regular Expression: ^(0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2})$
Pass: 0200|||7312|||2415
Fail: 0300|||7612|||2915
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With