Search code examples
c#regexexecutablevisual-studio-debugging

Running C# project from Visual Studio has different behavior from executables


I made a regex parser, among the various functionalities you can also see a DataGridView populated with capturing groups with their numbers and pattern. According to the documentation:

Captures that use parentheses are numbered automatically from left to right based on the order of the opening parentheses in the regular expression, starting from one. The capture that is numbered zero is the text matched by the entire regular expression pattern.

Now if I run the application from VIsual Studio I get what I'm expecting to see while running the executables generated in folders \bin\Debug or \bin\Release the order of some groups is wrong. See the picture below. The pattern used in the example is ^([^$]*(\$[^$]*\$)*[^$]*(\$[^$]*))([AB])(([^$]*\$)[^$]*(\$[^$]*\$)*[^$]*)$.

Why does this happen and how can I fix it? image

EDIT: SOLVED The original project was compiled with .Net 4.0, I recompiled with version 4.5 and now works well.


Solution

  • The original project was compiled with .Net 4.0, I recompiled with version 4.5 and now works well.