Snip off the connector, leaving a few centimeters of cable attached.
Strip back the jacket of the cable/connector so you can get to the wires.
Use a multimeter to match the wire colors to the connector pin positions. Write it down.
Disassemble the shell of the new connector (they're all different but come apart in some way so you can get to the terminals)
Prepare the cable by peeling the jacket back, separating the wires, and stripping the wires.
Solder the wires to the terminals, making sure to match the color/position you wrote down.
Assemble the connector shell.