fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. // This is the input string we are replacing parts from.
  9. string input = "select id, :DATA_INI, ':DATA_INI', titulo, date_format(data_criacao,'%d/%m/%Y %H:%i') str_data_criacao\n"
  10. + "from v$sugestoes\n"
  11. + "where data_criacao between :DATA_INI AND :DATA_FIM AND ':TEST'\n"
  12. + " and 'test ''string :DATA_INI '' :DATA_INI '\n"
  13. + "order by data_criacao";
  14.  
  15. string output = Regex.Replace(input, ":(?=([^']*'[^']*')*[^']*$)", "@");
  16.  
  17. Console.WriteLine(output);
  18. }
  19. }
Success #stdin #stdout 0.11s 24280KB
stdin
Standard input is empty
stdout
select id, @DATA_INI, ':DATA_INI', titulo, date_format(data_criacao,'%d/%m/%Y %H:%i') str_data_criacao
from v$sugestoes
where data_criacao between @DATA_INI AND @DATA_FIM AND ':TEST'
  and  'test ''string :DATA_INI '' :DATA_INI '
order by data_criacao