Regular Expressions in Zones

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Regular Expressions in Zones

Post by gjaros » Fri Aug 02, 2013 8:15 pm

I can't seem to get any regular expressions in the zones to work except for a simple * wildcard. Is this not working in ACGold b5731? Right now I'm just trying a very simple regex to include a range of zip codes. I'm trying to include 60803-60807 (for Illinois) by entering this:

6080[3-7]

And it's not recognizing 60803 as a valid postal code. 6080* works, but it incorrectly also recognizes 60801. Once we figure out how to enter regular expressions for zip code ranges we'll have a few more complex expressions for ranges, but I wanted to start simple and can't seem to get that working. Simple ranges aren't working either, so I can't enter 60803-60807. We need to enter ranges because the field length is too short for us to enter all the zip codes individually.

Am I entering the regex incorrectly? Or is it not working in ACGold any more?

Thanks.
Image
Image

User avatar
bkort@web2market.com
AbleCommerce Partner
AbleCommerce Partner
Posts: 113
Joined: Thu Jan 22, 2004 3:17 pm
Location: Illinois
Contact:

Re: Regular Expressions in Zones

Post by bkort@web2market.com » Tue Aug 06, 2013 9:49 am

Anyone have a comment on regular expressions in Gold?

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Regular Expressions in Zones

Post by Katie » Tue Aug 06, 2013 3:40 pm

I was able to confirm this is a bug. It's been reported and I requested a patch or work-around.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Regular Expressions in Zones

Post by Naveed » Tue Aug 06, 2013 10:37 pm

This do not seems a bug, the regular expressions are working for AC Gold, but we need to follow some guidelines to indicate that we are using regular expression based filters for postal codes. For example we need to start the filter with '@' to indicate the the filter is a regular expression. Here is a wiki link to "Postal Code Filter Pattern Matching" help document:
http://wiki.ablecommerce.com/index.php/ ... n_Matching

User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Re: Regular Expressions in Zones

Post by gjaros » Wed Aug 07, 2013 7:28 am

Thanks Naveed! The wiki article is very helpful.

Katie, the help documentation needs to be updated though because the AC Admin says to refer to the help files for more information about using regular expressions and the help file only mentions using the * wildcard. I don't think anyone would ever guess that you need to start a regular expression with the @ symbol. The help file at the very least needs a link to the wiki page about regular expressions.
Image
Image

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Regular Expressions in Zones

Post by Katie » Wed Aug 07, 2013 7:32 am

Yes, I have already been asked to update it.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
gjaros
AbleCommerce Partner
AbleCommerce Partner
Posts: 1717
Joined: Tue Feb 24, 2004 2:20 pm
Location: Illinois
Contact:

Re: Regular Expressions in Zones

Post by gjaros » Wed Aug 07, 2013 3:19 pm

We have our ranges working now, but it's made me wonder why the ability to easily add zip code ranges with a hyphen was phased out? Yes, you can do a lot more with regular expressions and that will help locales with alphanumeric postal codes, but for locations with only numeric codes the hyphenated ranges are super easy to set up.

For example, we wanted to offer a portion of North Carolina a certain shipping method based on zip code.

It would be really nice to be able to enter the following to cover the necessary zip codes, including a few ranges:

27805,27818,27820,27824,27826,27847-27849,27855,27862,27867,27869,27872,27877,27885,27897-27986,28349,28445,28454,28460,28501-28589,28594

But this doesn't work. The ranges don't work properly and if someone enters a zip+4 it doesn't work. In fact, entering a zip+4 doesn't work at all, unless each zip code entered has the * wildcard (e.g. 27805*,27818*, etc.). Instead, to get the ranges to work we need to enter a regular expression:

@^((27(8(05|18|2[046]|4[7-9]|55|6(2|7|9)|72|77|85|9[7-9]))|(9([0-7][0-9]|8[0-6])))|(28(349|4(45|54|60)|5(0[1-9]|[1-8][0-9]|94))))(-\d{4})?$

It's a lot more flexible, but much harder to understand and much, much harder to create. I like the ability to use a regular expression if needed, but simple ranges would be great, too. And automatically stripping out the +4 part if entered would be wonderful. We'd love it if zip code ranges were re-implemented (with regex support) as a much more user friendly way of creating zones.

Also, aside from the documentation needing to be updated to explain how to use regular expressions better, we noticed that the field in the database for included postal codes is 450 characters and the excluded postal codes is 500 characters, however the fields in the admin are limited to 255 characters. These should all be the same, and preferably larger.

Thanks!
Image
Image

Post Reply