The text variable is unintentionally modified by the InsertWords() function. If the variable text.text is "example ˣ here", with the variable text.words[0] being "TEST", the InsertWords() function will change the text.text to "example TEST here". I want the text variable to remain unchanged, while only the textCopy variable changes. How would I do that? And why does text.text change even though I never use regex.Replace on it?
public class TextClass {
    public List<string> words;
    public string text;
    public string name;
    public string date;
    public string id;
}
public TextClass text;
public TextClass InsertWords()
    {
        Regex regex = new Regex(Regex.Escape("ˣ"));
        TextClass textCopy = text;
        foreach (string word in inputWords)
        {
            textCopy.text = regex.Replace(textCopy.text, word, 1);
        }
        return textCopy;
    }
Edit: I use the function like this
public Display display;
display.DisplayText(InsertWords());
public class Display {
    public Text text;
    public void DisplayText (TextClass text_)
    {
        text.text = text_.text;
    }
}
 
     
     
    