+1 vote
in Website by (170 points)
Please let me help you optimize at least the US shipping company detection with your email token.  I've already created a perl script within the last couple hours that can detect USPS, FedEx and UPS tracking numbers without any special formatting in the email.  I'm adding china post and some others that I commonly use at the moment as well.  It would be great if I could at least format/re-send my emails to your service in a specific format, but even the following format isn't detected which makes me think the whole thing is currently broken?

Format I used and failed:

"

USPS

Tracking ID 9400111699000179776201

"

Obviously not including the quotes, but that format would be easily read by any decent regex filter.

Here are the perl regex statements I'm using - and they work:

# USPS

        if (/\b(\d\d\d\d ?\d\d\d\d ?\d\d\d\d ?\d\d\d\d ?\d\d\d\d ?\d\d|\d\d\d\d ?\d\d\d\d ?\d\d\d\d ?\d\d\d\d ?\d\d\d\d)\b/) {

                if ($1) {

                        push (@matches, "USPS: $1");

                }

        }

#FedEx

        if (/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/) {

                if ($3) {

                        push (@matches, "FedEx: $3");

                }

        }

#UPS

        if (/\b(1Z ?[0-9A-Z]{3} ?[0-9A-Z]{3} ?[0-9A-Z]{2} ?[0-9A-Z]{4} ?[0-9A-Z]{3} ?[0-9A-Z]|[\dT]\d\d\d ?\d\d\d\d ?\d\d\d)\b/) {

                if ($1) {

                        push (@matches, "UPS: $1");

                }

        }

Let me know if you want help, I can at least be a validation technician and help you test things.

--Micah

Please log in or register to answer this question.

Welcome to Deliveries Package Tracker Q&A, where you can ask questions and receive answers from other members of the community.

Categories

...