I'm using the latest version of Groovy (1.5.7). I was using Groovy to learn about formatting strings, and I was getting error messages were I shouldn't have. I searched the Internet for an answer, but I didn't find anything.
Here's some code from Sun's Java 1.5 doc pages; it works just as you would expect it in Java:
In your code, this: "Duke's Birthday: %1$tm %1$te,%1$tY" is parsed as a GString in Groovy, which means that Groovy will attempt to look through it to see if it needs to make any replacements, and one of the key characters it looks for is '$'. For example:
prints 'My name is Matt'. Groovy saw the '$'s in your GString and got confused, so you just had to escape out those characters.