I am fairly sure you don't want "template" there. What you probably want to do is a "strcat". So:
Code:
strcat(format_number(re_group($#kobobookmark, '.*\/file(\d+).*'),'{0:,d}'),'/',$$#chaptercount)
For the other part, you could do something like:
Code:
current_chapter = 0;
if contains($#kobo_reading_location, 'File','1','0') then
current_chapter = re_group($#kobobookmark, '.*\/file(\d+).*')
fi;
strcat(format_number(current_chapter,'{0:,d}'),'/',$$#chaptercount);
That should replace the line with the template in it.