Added exception handling

Fixed regex errors
forgot to commit