Use PHP's own validation of email address as opposed to trying to do our own
move email regex inside string_insert_hrefs
Replace multiple if statements with single switch statement