On 12/02/20 09:55, Chapman Flack wrote: > In Perl, there is a useful extension to regexp substitution where > you specify the replacement not as a string or even a string with & > and \1 \2 ... magic, but as essentially a lambda that is passed the > match and returns a computed replacement. That makes conversions of > the sort discussed here generally trivial to implement.
Python, I should have added, allows that also. Java too, since release 9. Regards, -Chap