Fix '%#' substitution for # > 9

Change '%#' substitution to use a regular expression for the 'old' text
to enforce a word boundary after '#', such that we don't perform e.g.
'%1' replacement on inputs like '%10'. This fixes problems trying to
modify functions with more than nine arguments, such as the example from
the previous commit (which now compiles and passes). Also add a test
case for this.

Change-Id: I9956804b3c65bddf7e36838866641b24ceb87c57
Reviewed-by: John Ehresman <jpe@wingware.com>