I've a string that ends with an even number of 0's padded to it. I want to remove these 0's by a regular expression (00)*:
ababababab000000 => ababababab
abababab00 => abababab
abab000000000 => abab0
aba00000 => aba0
How can this be done in Bash? In general, how would I remove any suffix using a regex?