refactored regex code into constants and put related logic into 2 methods