I need some advice. Suppose I have the following string: Read Variable
I want to find all pieces of text like this in a string and make all of them like the following:Variable = MessageBox.Show. So as aditional examples:
"Read Dog" --> "Dog = MessageBox.Show"
"Read Cat" --> "Cat = MessageBox.Show"
Can you help me? I need a fast advice using RegEx in C#. I think it is a job involving wildcards, but I do not know how to use them very well… Also, I need this for a school project tomorrow… Thanks!
Edit: This is what I have done so far and it does not work: Regex.Replace(String, "Read ", " = Messagebox.Show").
You can do this
\s+matches 1 to many space characters(.*?)(?:\s|$)matches 0 to many characters till the first space (i.e\s) or till the end of the string is reached(i.e$)$1represents the first captured group i.e(.*?)