You have
three (
) commas in that template. Commas separate arguments in the function. re() takes three arguments -- val, pattern, replacement -- and the first is inferred as author_sort from the template. (val is only used in general and template program mode, not single-function mode which is what we are using here). You have also left args 1 & 3 empty.
More on this in the calibre template tutorial:
http://manual.calibre-ebook.com/template_lang.html
Function reference:
http://manual.calibre-ebook.com/template_ref.html
Try:
Code:
{author_sort:re(([^\s.])[^\s.]*(?:(?:$|\s|\.)+), \1. }