- Home /
Help with Error: An instance of type 'Regex' is required to access non static member 'Replace'.
I am getting this error after upgrading to 3.0 I don't understand the error.
Here's the code.
import System.Text.RegularExpressions;
newdog="first second third";
newdog1=Regex.Replace(newdog,"first",1);
newdog2=Regex.Replace(newdog1,"second",2);
This is just example code to illustrate the problem.
Thanks,
Dan
Answer by dansav · Nov 17, 2010 at 04:00 AM
I found the answer.. The problem is that the last argument cannot be an Integer it must be a string. so I had to do "1" or if it was a variable that's an integer I would have to do myint.ToString();
Dan
Your answer
Follow this Question
Related Questions
An instance of type X is required to access non static member Y [javascript] 4 Answers
Problem setting up an array with a size determined by a variable 2 Answers
An instance of type "x" is required to access non-static variable "y" 2 Answers
Instantiating a Coroutine? 2 Answers
Replace() with string and Regex not replacing numbers/integers 2 Answers