<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>UK Postcode Validation</title><link>https://www.infopathdev.com:443/forums/thread/103102.aspx</link><pubDate>Fri, 03 Jul 2015 13:17:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:103102</guid><dc:creator>Steven_Smith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/103102.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=103102</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;So after searching the internet for a considerable amount of time to try to find the right way to validate UK postcodes to a fairly accurate dataset I have come up with the following solution. For reference the field containing my postcode is called Postcode.&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;Using the formatting conditions input the following:&lt;/p&gt;

&lt;table&gt;

&lt;tr&gt;
&lt;td&gt;Field&lt;/td&gt;
&lt;td&gt;Match Type&lt;/td&gt;
&lt;td&gt;Condition&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Postcode&lt;/td&gt;
&lt;td&gt;does not match pattern&lt;/td&gt;
&lt;td&gt;[A-PR-UWYZ][A-HK-Y]?[0-9]{1,2} ?[0-9][ABD-HJLNP-UW-Z]{2}&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Postcode&lt;/td&gt;
&lt;td&gt;does not match pattern&lt;/td&gt;
&lt;td&gt;[A-PR-UWYZ][0-9][A-HJKSTUW] ?[0-9][ABD-HJLNP-UW-Z]{2}&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Postcode&lt;/td&gt;
&lt;td&gt;does not match pattern&lt;/td&gt;
&lt;td&gt;[A-PR-UWYZ][A-HK-Y][0-9][CDFGI-LOQSTUZ] ?[0-9][ABD-HJLNP-UW-Z]{2}&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Postcode&lt;/td&gt;
&lt;td&gt;is equal to&lt;/td&gt;
&lt;td&gt;GIR 0AA&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;All these should end with an &amp;quot;and&amp;quot;. Use custom pattern to insert the conditions for pattern matching.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;There are a lot of RegEx examples out there, however InfoPath doesn&amp;#39;t fully support it. If anyone has a better solution than this I would be interested to hear it, as this isn&amp;#39;t the most elegant of solutions.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>