Fix infinite loop when adding a capital in puppet syntax

A loop is caused in the Puppet mode when adding a capital letter
due to an incomplete regex match and use of the backUp function.
Resolving this issue required checking for a full match against
the word before calling backUp on the stream.