I need to remove any zero values from the end of a string. There could be no matches, or there could be several matches. Some examples:
10d 5h 0m 0s would become 10d 5h
10d 5h 10m 0s would become 10d 5h 10m
10d 0h 0m 0s would become 10d
I toyed with the following regex:
(0h)?\s(0m)?\s(0s)$
But it only matches the first and third example. What am I doing wrong?