Thanks for your quick response! It seems i have oversimplified my test string. "aul";1;200;"aap"noot";"cafe "'t hoekje"";piet The string can start with a double quote, which is ok. Can you fix this easily?
Guus2005
Posts
-
Remove all double quotes not directly preceded or directly followed by a semicolon. -
Remove all double quotes not directly preceded or directly followed by a semicolon.Hi, I have 3000 large csv files which give an error when i bulk insert them into a sql server table. This is caused by the fact that some text fields, which are surrounded by double quotes sometimes have quotes in them: 1;200;345;"Apotheker "Blue tongue"";"Apeldoorn";12;"ABCD12" 2;232;312;"Café "Blue Oyster";"Rotterdam";33;"DCBA21" Sometimes 1 and sometimes 2 double quotes too many. They need to be removed or replaced by single quotes. Like this: 1;200;345;"Apotheker Blue tongue";"Apeldoorn";12;"ABCD12" 2;232;312;"Café Blue Oyster";"Rotterdam";33;"DCBA21" In short the solution is this: Remove all double quotes not directly preceded or directly followed by a semicolon. I bought RegexBuddy and RegexMagic to help me on my quest but no solution is forthcomming. I want to use powershell to scan all the files and replace where necessary. I hope you can help me. Thanks for your time