Fix incorrect formatting when format contains digit
Add support of format with numeric characters