Adding the RegExp class to Shopify Scripts API would open up a lot of additional functionality in Shipping Script in particular that is currently either difficult or impossible to do with the existing API. For instance RegExp would allow for:
Right now the only string tests I'm aware of are ==, starts_with? and ends_with? which makes for difficulty in correctly testing the first use case mentioned above. Instead of
Input.cart.address1 =~ /^(p\.*o\.*|box)/i || Input.cart.address2 =~ /^(p\.*o\.*|box)/i
I have to generate all of the possible combinations of characters matching that RegExp (with something like https://github.com/teeshop/rexgen) and add them to an array to then test with .starts_with?. This is very hackey and could be easily resolved with assess to RexExp functionality builtin to the script API.
This would help solve the long standing PO box issue and other I'm sure as well. Please add RexExp to the list of available classes in the Shopify Script API. Thanks!
|04-02-2020 10:19 PM|
|04-02-2020 01:54 PM|
|04-02-2020 05:01 AM|
|04-02-2020 04:52 AM|
|04-02-2020 04:04 AM|