in reply to Regex for replacement
Misread the question earlier.
English is not my mother language
s{.+(?=/main)}{what ever u need}g; [download]
s{.+(?=/main)}{what ever u need}g;
This solution still doesn't preserve the /abc/, as the OP stated was a requirement. I don't see the need for the /g modifier either.
Dave