I am writing a script that needs to download images related to a product ID array to an external website. Here are the possible product ID combinations.
- ABC1234AB
- ABC1234AB-CD
- ABC1234AB-CDE
- ABC1234ABC
I need to be able to convert them to their URL equivalent on the manufacturer's website, which are (In the same order):
- abc1234_ab
- abc1234_ab_cd
- abc1234_ab_cde
- abc1234_abc
I am looking for a Regex to use with preg_replace that would do the trick. Thanks in advance!