(May-23-2022, 10:02 PM)Clunk_Head Wrote: I found regex to be slower than replace() by at least a factor of 10
I'm pretty confident that regex will be faster than your recursive function with many ifs. Still, the officially pythonic way is to try to convert and catch an exception...