Fix trailing ( in syntax definitions, and use regex for all functions