How to check a collided gameobject for valid tags?

I’m creating a teleport script that only teleports gameobjects with certain tags to be allowed to use it. I am using an array for a list of valid tags to activate the gameobject to teleport.

void OnTriggerEnter(Collider other) {
	if (other.gameObject.tag == "Player") {
		TeleportEffects (enterParticles, other.transform.position, other.transform.rotation);
		if (exit == null) {
			other.transform.position = newPosition;
			other.transform.rotation = Quaternion.Euler (newRotation);
		else {
			var otherController = other.GetComponent<CharacterController>().height;
			other.transform.position = exit.position + Vector3.up * otherController / 2;
			other.transform.rotation = exit.rotation;
		TeleportEffects (exitParicles, other.transform.position, other.transform.rotation);
		if (telesound != null)
		AudioSource.PlayClipAtPoint (telesound, other.transform.position); 

I want to replace the “Player” string with public string validTags . How do I replace this and check all the array elements when the you enter the trigger box?

No reason to use loops, just use Contains if you’re using a List:

if (validTags.Contains(other.gameObject.tag)) {

Or IndexOf for an array:

if (System.Array.IndexOf(validTags, other.gameObect.tag) != -1) {

I would do the following

void OnTriggerEnter(Collider other) {
 for(int i = 0; i < validTags.Length; i++){
   if (other.gameObject.tag == validTags*) {*