[Skip to main content](#vessel-content)

#   Regular expression on postal code field not working

##

- **[remcovolbeda](/forum/user/56255-remcovolbeda "View remcovolbeda's Profile")**
- [![remcovolbeda's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56255-remcovolbeda "View remcovolbeda's Profile") Topic Author
- [ Offline](/forum/user/56255-remcovolbeda)

Less More

- Posts: 22
- Thank you received: 2
-
-

4 years 4 months ago [\#342661](#342661) by [remcovolbeda](/forum/user/56255-remcovolbeda "View remcovolbeda's Profile")  *[Regular expression on postal code field not working](/forum/32-content-creation/904620-regular-expression-on-postal-code-field-not-working#342661 "-- url of the page with the problem -- :   paintmaster.nl  -- HikaShop version -- : 4.6.0 -- Joomla version -- : 4.1.5 -- PHP version -- : 8.0.20 -- Browser(s) name and version -- : all browsers -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I can not get the regular expression to work in &quot;display / custom fields / address&#95;post&#95;cde . The expresson I use is this:  /^&#91;1-9&#93;&#91;0-9&#93;{3}&#91;&#92;s&#93;?&#91;A-Za-z&#93;{2}$/i  For dutch postal codes like &quot;1039 AA&quot; and &quot;3224cc&quot;  I have set the field to &quot;Required&quot;, but all entries say that it is not a right postal code. Even a very simple regular expression never validates right.  Kind regards, Peter")* was created by *[remcovolbeda](/forum/user/56255-remcovolbeda "View remcovolbeda's Profile")*

-- url of the page with the problem -- : [ paintmaster.nl](https://paintmaster.nl)
-- HikaShop version -- : 4.6.0
-- Joomla version -- : 4.1.5
-- PHP version -- : 8.0.20
-- Browser(s) name and version -- : all browsers
-- Error-message(debug-mod must be tuned on) -- : no error message

Hi,

I can not get the regular expression to work in "display / custom fields / address_post_cde . The expresson I use is this:

/^[1-9][0-9]{3}[\s]?[A-Za-z]{2}$/i

For dutch postal codes like "1039 AA" and "3224cc"

I have set the field to "Required", but all entries say that it is not a right postal code. Even a very simple regular expression never validates right.

Kind regards,
Peter

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTA0NjIwLXJlZ3VsYXItZXhwcmVzc2lvbi1vbi1wb3N0YWwtY29kZS1maWVsZC1ub3Qtd29ya2luZz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14294
-
-

4 years 4 months ago [\#342663](#342663) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Regular expression on postal code field not working](/forum/32-content-creation/904620-regular-expression-on-postal-code-field-not-working#342663 "-- url of the page with the problem -- :   paintmaster.nl  -- HikaShop version -- : 4.6.0 -- Joomla version -- : 4.1.5 -- PHP version -- : 8.0.20 -- Browser(s) name and version -- : all browsers -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I can not get the regular expression to work in &quot;display / custom fields / address&#95;post&#95;cde . The expresson I use is this:  /^&#91;1-9&#93;&#91;0-9&#93;{3}&#91;&#92;s&#93;?&#91;A-Za-z&#93;{2}$/i  For dutch postal codes like &quot;1039 AA&quot; and &quot;3224cc&quot;  I have set the field to &quot;Required&quot;, but all entries say that it is not a right postal code. Even a very simple regular expression never validates right.  Kind regards, Peter")*

Hi,

You should only use: Code:

^[1-9][0-9]{3}[\s]?[A-Za-z]{2}$

The / around are added by HikaShop.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTA0NjIwLXJlZ3VsYXItZXhwcmVzc2lvbi1vbi1wb3N0YWwtY29kZS1maWVsZC1ub3Qtd29ya2luZz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.050 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
