C# regex match always return false -


here test case c# regex match:

aaa bb aaa+15d bb-205w 

the pattern have used is: @"^(aaa|bb)([\+|\-]\d+[d|w])*$", when test online in .net regex tester, says match. when run in c# codes, return false last 2 test cases. wrong pattern?

i can't reproduce mentioned behaviour

list<string> input = new list<string>() { "aaa", "bb", "aaa+15d", "bb-205w" }; string pattern = @"^(aaa|bb)([+-]\d+[dw])*$"; foreach (string item in input) {     console.writeline(regex.ismatch(item, pattern)); } 

result:

true  true  true  true 

Comments