Updating code to use regex instead of if statements