-4

I'm studying a program written in c #. I do not understand this regular expression, can you explain to me what it does? Thank you

Match numberMatch = Regex.Match(patternOutput, "(#+)([\\.|,])(#+)");
Acav
  • 3
  • 1

1 Answers1

2

https://regex101.com/ provides a convenient explanation to pretty much all possible kinds of regex syntaxes. In your case the regex matches a literal # character at the beginning, followed by one of the characters in the square brackets (each of them literally, where the backslash is escaped by another one): [\\.|,], so this will match either \, ., |, ,. And at the end follows one more # character.

D. Petrov
  • 1,097
  • 12
  • 22