Everything in string.gsub() is replaced, not only the matching group. By using two groups, we can correctly return the full matched string when none of the special conditions apply. Fixes <https://github.com/koreader/koreader/issues/8486>.
pairs