Template filter: compile regexes once, include # and @ in link text