Skip to content

Instantly share code, notes, and snippets.

@emmaly
Created January 14, 2023 02:35
Show Gist options
  • Save emmaly/1128892905ea2e0cdde325e4f55980ed to your computer and use it in GitHub Desktop.
Save emmaly/1128892905ea2e0cdde325e4f55980ed to your computer and use it in GitHub Desktop.
Regular Expression for Tracking Numbers
\b(?:(?<International>[A-Z]{2}[0-9]{9}[A-Z]{2})|(?<FedEx>[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?(?:[0-9]{3})?)|(?<UPS>(?:(?:(?:1Z)[0-9A-Z]{16})|(?:(?:T)[0-9A-Z]{15}[0-9])|(?:[0-9]{9})|(?:[0-9]{26})))|(?<USPS>(?:(?:(?:93|92|94|95)[0-9]{2} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{2,4})|(?:(?:70|14|23|03)[0-9]{14})|(?:(?:M0|82) ?[0-9]{3} ?[0-9]{3} ?[0-9]{2})|(?:(?:[A-Z]{2})[0-9]{9}(?:[A-Z]{2})))))\b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment