Goal:
Make sure that the data1 and all the way to data31 is correct and data4 and all the way to data7 is error with support of regex
Regex regexp = new Regex(@"^[a-zA-Z]:\\.*$");
in C#.
Problem:
data6 and data7 is supposed to be error but instead it is correct.
Don't know how to solve it.
Regex regexp = new Regex(@"^[a-zA-Z]:\\.*$");
//Correct result
string data1 = "C:\\33\\dd\\Desktop\\151222055438.txt";
string data2 = "c:\\ff\\ded\\Desktop\\151222055438.txt";
string data3 = "Z:\\ss\\gg\\Desktop\\151222055438.txt";
string data31 = "d:\\da\\ds\\Df\\ff.txt";
//Error result
string data4 = "3:\\rr\\555\\Desktop\\151222055438.txt";
string data5 = "d\\33\\4\\Desktop\\151222055438.txt";
string data6 = "s:\\\\rr\\d\\Desktop\\151222055438.txt";
string data7 = "s:\\\\\\f\\f\\Desktop\\151222055438.txt";
if (regexp.Match(data1).Success)
{
int correct = 23;
}
if (regexp.Match(data2).Success)
{
int correct = 23;
}
if (regexp.Match(data3).Success)
{
int correct = 23;
}
if (regexp.Match(data31).Success)
{
int correct = 23;
}
if (regexp.Match(data4).Success)
{
int error = 23;
}
if (regexp.Match(data5).Success)
{
int error = 23;
}
if (regexp.Match(data6).Success)
{
int error = 23;
}
if (regexp.Match(data7).Success)
{
int error = 23;
}
int sds = 23;