Replacing one color in the texture

I am not experienced enough with the fixed function pipeline. Hopefully someone can help.
At the end of the post is a simple shader which always draws the ‘_MainTexture’ except if it had to draw a pixel with ‘_Color’. In that case it uses ‘_ReplaceTex’.
Is it possible to write such a shader without cg?

Shader "Experiment/Replace Colored Area" {
	Properties {
		_Color ("Replace Color", Color) = (1,1,1,1)
		_MainTex ("Main Texture", 2D) = "white" {}
		_ReplaceTex ("Replace Texture", 2D) = "white" {}
	}
	SubShader {
		Pass {

CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

float4 _MainTex_ST;
float4 _Color;
sampler2D _MainTex;
sampler2D _ReplaceTex;

struct v2f {
	float4 position: POSITION;
	float2 uv: TEXCOORD0;
};

v2f vert (appdata_base i) {
    v2f o;
    o.position = mul (glstate.matrix.mvp, i.vertex);
    o.uv = TRANSFORM_TEX (i.texcoord, _MainTex);
    return (o);
}

float4 frag (v2f i): COLOR {
	float4 texColor = tex2D ( _MainTex, i.uv);
	if (texColor.xyz == _Color.xyz) {
		texColor = tex2D ( _ReplaceTex, i.uv);
	}
	return (texColor);
}
ENDCG

		}
	}
}

There are no conditionals in the fixed function pipeline, except for alpha and Z testing. Available fixed function texture operations are listed here: Unity - Manual: ShaderLab: legacy texture combining

Thanks for your answer. I expected that it would not be easy. So I will try to use ‘AlphaTest Equal’.

Is there some reason you can’t do this with an alpha channel?

It is possible that there will be more than 256 different colors or alpha values. But I could split it up for that case. The first tests were successful and the shader was very simple to implement.

Shader "Experiment/Replace Alpha Area" {

	// Idea:
	// Always draw '_MainTex'.
	// In the case that '_Alpha' and the alpha value in
	// '_ReplaceTexWithAlphaLookup'
	// are the same, draw the rgb colors of
	// '_ReplaceTexWithAlphaLookup' without
	// it's alpha component.

	Properties {
		_Alpha ("Replace Alpha", Range (0.0, 1.0)) = 0.0
		_MainTexture ("Main Texture", 2D) = "white" {}
		_ReplaceTextureWithAlphaLookup ("Replace Texture with Alpha Lookup", 2D) = "white" {}
	}
	SubShader {
		Pass {
			SetTexture [_MainTexture] { combine texture }
		}
		Pass {
			AlphaTest Equal [_Alpha]
			SetTexture [_ReplaceTextureWithAlphaLookup] {combine texture}
		}
	}
}