The program looks at the list of directories, you need to weed out the folders that start with a number with a dot

Suppose there is a list:

1. OLD
2. MINI
MyProject1
MyProject2
MyProject3

But the regular expression for some reason does not work

Regex isCategory = new Regex(@"^[0-9]+\. [a-zA-Z]+", RegexOptions.IgnorePatternWhitespace); if(isCategory.IsMatch(item.Name)) { textBox.Text += item.Name + " - isCategory\r\n"; } else { textBox.Text += item.Name + "\r\n"; } 
  • What exactly is not working? Even a simple version ^[0-9]+\. triggered by me. - Monk
  • 2
    You yourself have specified the option IgnorePatternWhitespace - that’s the pattern doesn’t match. - Alexander Petrov

1 answer 1

RegexOptions.IgnorePatternWhitespace

It's too much.