Cleaned up the code while at it by de-duplicating the regex.