The concern I see is the position (and length) of the orderId within the URL. Will the position (and length) always be the same? If it will be, then substring may work. If it will not be, then I might look into the split method instead.
"assume the orderid is in the 6th position"
orderId = url.split('\')[5]
Here are a couple of ideas to assist you: