Revised code to meet requirements without the use of RegEx. Refactoring needed.