I think the actual result is expected. It is partition's responsibility to match the left-most position possible, and it is +'s responsibility to match as long as possible from that position. Likewise, it is rpartition's responsibility to match the right-most position possible, and it is +'s responsibility to match as long as possible from that position. ["...99", "9", "..."] matches at index 5, which is more right than the index given by partitioning into ["...", "999", "..."], which is 3. And since matching starts at index 5, there is no extending of the match to index 6, which is ..
If you want to match 999 with rpartition, you need to do something like: