C# method contents regex validation

Posted by user258651 on Stack Overflow See other posts from Stack Overflow or by user258651
Published on 2010-03-18T21:30:28Z Indexed on 2010/03/18 21:31 UTC
Read the original article Hit count: 287

Filed under:
|
|

I need to validate the contents of a C# method.

I do not care about syntax errors.

I do care about characters that will invalidate parsing of the rest of the code. For example:

method()
{
  /* valid comment */
  /*           <-- bad
  for (i..) {
  } 
  for (i..) {  <-- bad
}

I need to validate/fix any non-paired characters.

This includeds /* */, { }, and maybe others.

How should I go about this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex