I am trying to use a variable in my regex pattern. This variable will always change and never be the same.
Whenever I try to use it in the pattern it gives me an error. Since the variable im using is a path, it sees "\" as an escape sequence and whichever letter as well so for example "c:\users" would be seen as "\u" which gives me an error.
I was wondering if there is any way around this, like i said this variable is always changing and hard coding any values wouldn't work.
Here is my existing code for the regex pattern:
public static Boolean validateFilePath(String dstPath, String newFileDstPath)
{
Boolean blnflag = false;
Match m = Regex.Match(newFileDstPath, @""+ dstPath + "");
if (m.Success)
{
blnflag = true;
}
return blnflag;
}