use a regex pattern instead for better performance