JosHaemers
New member
- Joined
- Oct 18, 2014
- Messages
- 2
- Programming Experience
- 5-10
Goodmorning
I want to replace a character if between text qualifiers but it is not working. What I want to do is to replace a semicolumn ; only if it is between textqualifiers ".
Example:
0;0;0;01.01.1994;"";"";0;"";"";"NV58TT;NL";"_LP";303;"*";""
"NV58TT;NL" has to be replaced by "NV58TT NL"
I've tried this code so far:
Dim pattern As String = "(;\s*?"".*?)((\s+.*?""\s*?"
Dim buffer As String
Using tr As TextReader = File.OpenText(strSourceFile)
buffer = Regex.Replace(tr.ReadToEnd, pattern, " ")
End Using
File.WriteAllText(strSourceFile, buffer)
I want to replace a character if between text qualifiers but it is not working. What I want to do is to replace a semicolumn ; only if it is between textqualifiers ".
Example:
0;0;0;01.01.1994;"";"";0;"";"";"NV58TT;NL";"_LP";303;"*";""
"NV58TT;NL" has to be replaced by "NV58TT NL"
I've tried this code so far:
Dim pattern As String = "(;\s*?"".*?)((\s+.*?""\s*?"
Dim buffer As String
Using tr As TextReader = File.OpenText(strSourceFile)
buffer = Regex.Replace(tr.ReadToEnd, pattern, " ")
End Using
File.WriteAllText(strSourceFile, buffer)