Fabio Delarias
Fabio Delarias

Reputation: 380

I don't understand why this regex always returns false?

Ok here is is the regex:

Match CMD = Regex.Match(CommandString, @"\(([a-z0-9]+);(INTEGER|DECIMAL|STRING);(d{1,3});(((YES|NO);){3})([a-z0-9]+)\)", RegexOptions.IgnoreCase);

if (CMD.Success){
   return true;
}
return false;

the following patterns should return true:

(ID;Integer;12;YES;YES;YES;0)

(weak;String;5;NO;YES;YES;super)

(fabris345;decimal;23;YES;YES;YES;0)

(expr12nd;String;455;NO;YES;NO;super1000)

but they always return false. Why?

Upvotes: 2

Views: 64

Answers (1)

Soony
Soony

Reputation: 913

...(d{1,3})... should be (\d{1,3})

Upvotes: 5

Related Questions