So,
you have matched a string with \d and now want to do some math.
What is that you say?
The number your captured plus 5 is 5?
Oh,
that is right \d now matches UNICODE digits not [0-9].
What to do?
Well,
You can just call digits_to_int and all of your troubles* are over!

The digits_to_int function transliterates a string of UNICODE digit characters to a number you can do math with, non-digit characters are passed through, so "42 is \x{1814}\x{1812}" becomes "42 is 42".

You can optionally pass an argument that controls what happens when the source string contains non-digit characters or characters from different sets of digits. ERRORHANDLING can be one of "strict", "loose", "looser", or "loosest". Their behaviours are as follows:

My understanding of UNICODE is flawed, therefore, I have undoubtly done something wrong. For instance, what should be done with "5\x{0308}"? Also, there is a bunch of stuff relating to surrogates I don't understand.