The template language is pretty simple, it contains a bunch of builtin functions() that you can apply directly to a {template}
Now, as Kovid implied, you can trivially create your own arbitrary functions in python as well.
The builtin regular expressions function is pretty simple to use.
Code:
{title_sort:re(',)}
EDIT: ninjaed again...
We have great timing and synchronicity, I see.