making slugging code more robust with regex