fork(2) download
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5.  
  6. namespace Test
  7. {
  8. class Test
  9. {
  10. static void Main()
  11. {
  12. string s0 = @"Public Class Class1
  13. Public Sub New()
  14. ''asdasdas
  15. Dim a As String = """" REM asdasd
  16. ''' asd ad asd
  17. End Sub
  18.  
  19.  
  20. Public Sub New(ByVal strg As String)
  21.  
  22. Dim a As String = ""Name='Soham'""
  23.  
  24. Dim b As Boolean = True ' a ""line ending"" comment
  25.  
  26. End Sub
  27.  
  28.  
  29. End Class";
  30. string r1 = @"(?m)^[ \t]*(?:(?:REM|')[^\r\n]*)?[\r\n]+";
  31. string r2 = @"(?mn)^(?<line>[^\r\n""R']*((""[^""]*""|(?!REM)R)[^\r\n""R']*)*)(REM|')[^\r\n]*";
  32. Console.WriteLine(s0);
  33. string s1 = Regex.Replace(s0, r1, String.Empty);
  34. s1 = Regex.Replace(s1, r2, @"${line}");
  35. Console.WriteLine("\n\n{0}", s1);
  36. }
  37. }
  38. }
Success #stdin #stdout 0.06s 38224KB
stdin
Standard input is empty
stdout
Public Class Class1
    Public Sub New()
        ''asdasdas
        Dim a As String = "" REM asdasd
        ''' asd ad asd
    End Sub


    Public Sub New(ByVal strg As String)

        Dim a As String = "Name='Soham'"

        Dim b As Boolean = True ' a "line ending" comment

    End Sub


End Class


Public Class Class1
    Public Sub New()
        Dim a As String = "" 
    End Sub
    Public Sub New(ByVal strg As String)
        Dim a As String = "Name='Soham'"
        Dim b As Boolean = True 
    End Sub
End Class