Fix tilde/caret when followed by numeric characters.

Change-Id: Ic61d7dd98095de301a9aa40983603b2ddf2640f6