Thanks very much for all your effort. I've looked through your code and I like the improvements that you have made.

The new data format is much nicer. As this function will become part of a few other existing functions, I had originally wanted to keep the data in the same format as those. Since no one would ever need to read the data in its raw format, I didn't feel it was neccessary to make it readable. But I much prefer your way, as you say, it makes sense.

I did originally use ranges i.e. "1-200, 201-400, 401-600" instead of a "length", but this would mean having to use a whole other level of error checking i.e. check the right side is higher than the left side etc (me attempting to be efficient). I would very much like to go back to ranges.

I haven't delved enough into regular expressions yet, so thank you for explaining how to not capture a particular group. I never knew it was possible.

"Cost operations" allow me to most importantly make delivery free after a certain weight i.e. Europe over 10000g will be 0.00.

The most important part, which I hadn't yet got round to doing is what I explained previously, since the maximum weight for i.e. Europe is 2000g, I would need the rates to "repeat" so that i.e. order = 3000g (above the max), first package = 2000g, second package = 1000g. I planned on doing this with some kind of $weightoffset, which will restart while appending to the existing $totalcost after i.e. 2000g. I hope I have explained this properly.

Anyhow, I will continue work on your refined function tomorrow. And I would massively appreciate any help or advice as you have done so already, its very helpful to see how others refine what i've done.