I imagine there are two problems, the first would be to replace ; for ,, this can be solved with a texto.Replace(";", ",");. The other would be to return these occurrences, in this case would be more or less like this
var texto = "asfdgsdfgsdfg\"\"\"texto;texto\"\"\"fawsgasdfasdfasd\"\"\"texto;texto\"\"\"sadfgsdfgsdfg\"\"\"texto;texto\"\"\"fasdfasdfasdfasdf\"\"\"texto;texto\"\"\"sadf";
var pattern = @"""""""\w*;\w*""""""";
var linhas = Regex.Matches(texto,pattern);
System.Console.WriteLine(linhas.Count);
When you have problems with regex you can use the regexstorm it works well for . net, since apparently regex implementations in languages differ from each other.
If you want to replace ; for , in each of the occurrences, you can use something in that sense
var texto = "asfdgsdfgsdfg\"\"\"texto;texto\"\"\"fawsgasdfasdfasd\"\"\"texto;texto\"\"\"sadfgsdfgsdfg\"\"\"texto;texto\"\"\"fasdfasdfasdfasdf\"\"\"texto;texto\"\"\"sadf";
var pattern = @"""""""\w*;\w*""""""";
var textoModificado = Regex.Replace(texto, pattern,
encontrato =>
{
return encontrato.Value.Replace(";", ",");
});
System.Console.WriteLine(texto);
System.Console.WriteLine(textoModificado);
wants to replace the
;for,, that’s it?– Ricardo Pontual
Yes, it is in this case and csv this sepado by
;, and has a written value"""um texto qualquer; outro texto qualtquer""". And it turns out that he recognizes this ; as a delimiter also and ends up creating an extra column. I was seeing and has ways of not changing the value of;and change the logic ofsplit(), but I still can’t solve– Robson Silva