Hi all,
I'm putting together some regexps to handle redirecting incoming links from an old site to the equivalent page on the new site. I'm hoping I can handle the following situation in the regexp so I don't have to do it on the back-end:
Incoming link: /reservations/inn_details.asp?num=717
Redirected link: /reservations/property-detail.aspx?pid=00717
As you can see, the original query string value of 717 needs to be 00717 in the redirected link. The rule is that these IDs all need to be five characters long in the redirected URL.
So my question is: is it possible within the regexp to figure out how many charactes the query string value is, and then add enough leading 0s to it to equal five characters?
I could do four separate regexps to cover cases where the value is 1, 2, 3 or 4 digits long, but it'd be much cooler do handle it all in one fell swoop!
Thanks, B.