cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

UK postcode Rule

Former Member
0 Likes
1,899

Hi All,

I tried to write a a rule for UK postcode validation by using Match Pattern .when I test it giving right answers.

but this match pattern passing just first half postcode (AA9)  also pass.

when I bind it to the postcode column it passing all the patterns except Just Numbers(12345,123456,7896-----fail) in that field.

it gives score 9.99.

Did anyone came across this problem,

please help me out or please can anyone share if they wrote the rule for this already.

Regards

Kumarr

View Entire Topic
Former Member
0 Likes

Hi Adrian Thanks for the good suggestion with example.I tried the same with regular expression.

showing sample

(match_regex($POSTCODE, '[A-Z][0-9]{2} [0-9]{1}[A-Z]{2}', NULL)

match_regex($POSTCODE, '[A-Z]{2}[0-9] [0-9]{1}[A-Z]{2}', NULL)

match_regex($POSTCODE, '[A-Z][0-9][A-Z] [0-9]{1}[A-Z]{2}', NULL))

And  Thanks for the link also.