fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Example
  5. {
  6. public static void Main()
  7. {
  8. string pattern = @"(?<!#[^\n]*)\((?![^()]*\)\))";
  9. string substitution = @"{";
  10. string pattern2 = @"(?<!#[^\n]*)\)(?!\))";
  11. string substitution2 = @"}";
  12. string pattern3 = @"^( |\t)*(\w+)\1*::\1*\2\{\1*}";
  13. string substitution3 = @"$2::$2()";
  14.  
  15. string input = @"TropicalFruitTOutput::TropicalFruitTOutput()
  16. : dad::CRunnable()
  17. , m_watermelon_out()
  18. #if MAX_FRUITS == (10)
  19. , m_cherry_out()
  20. #endif
  21. {
  22. }
  23.  
  24. NationalFruitInput::NationalFruitInput()
  25. , m_banana_in()
  26. , m_dragronFruit(PAD_GetdragronFruitPAD_B(xcxcxc))
  27. {
  28. }
  29.  
  30. SpecialFruits::SpecialFruits()
  31. : AmazingClassType()
  32. , m_kiwi()
  33. , m_avocado( // PRQA S 2961 # FALSEPOSITIVE QAC warning about uninitialized
  34. // Hello world
  35. // This is just a comment for
  36. // testing purpose
  37. m_apricotController.getApricotList())
  38. {
  39. }
  40.  
  41. using NewFruitsBase::NewFruitsBase;";
  42.  
  43. RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
  44.  
  45. Regex regex = new Regex(pattern, options);
  46. string result = regex.Replace(input, substitution);
  47. Regex regex2 = new Regex(pattern2, options);
  48. string result2=regex2.Replace(result,substitution2);
  49. Regex regex3 = new Regex(pattern3, options);
  50. string result3=regex3.Replace(result2,substitution3);
  51.  
  52. Console.WriteLine(result3);
  53. }
  54. }
  55.  
Success #stdin #stdout 0.08s 29508KB
stdin
Standard input is empty
stdout
TropicalFruitTOutput::TropicalFruitTOutput()
   : dad::CRunnable{}
   , m_watermelon_out{}
#if MAX_FRUITS == (10)
   , m_cherry_out{}
#endif
{
}

NationalFruitInput::NationalFruitInput()
   , m_banana_in{}
   , m_dragronFruit{PAD_GetdragronFruitPAD_B(xcxcxc)}
{
}

SpecialFruits::SpecialFruits()
   : AmazingClassType{}
   , m_kiwi{}
   , m_avocado{  // PRQA S 2961 # FALSEPOSITIVE QAC warning about uninitialized
                                 // Hello world
                                 // This is just a comment for
                                 // testing purpose
        m_apricotController.getApricotList()}
{
}

using NewFruitsBase::NewFruitsBase;