Added function to detect if a string is alphanumeric