In Python, I would like to replace the "be" into "nl" in the following string:
http://test.nl/be/nl/product/abc-dadf-adsfsw-12234/
BUT!! I want it to check the part BEFORE /product/, because if the string after /product/ contains a "be" it has to remain the same.
Examples:
http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/ (part BEFORE /product/ contains no be, so has to remain the same)
http://test.nl/be/nl/product/abc-dadf-be-adsfsw-12234/ (part BEFORE /product/ contains be, so it has to be replaced with nl, so it becomes http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/)
http://test.be/nl/nl/product/abc-dadf-be-adsfsw-12234/ (part BEFORE /product/ contains be, so it has to be replaced with nl, so it becomes http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/)
"http://test.nl/be/nl/product/.*"?