'How to remove quote?

I am trying to come up with the correct C# regex to remove unwanted quotes in a csv file. It can be word/numeric combination with quotes inside of a column.

Is there a simple regex to remove the quotes around the bold words. Only want the quotes removed.

"Testing","Test123", "**"Test0202**" else", "Test 223 **"testing**" end"
"Orange", "Banana", "**"apple**" crown", "tasty **"Grapes**" end"

I have tried to look at a few regex examples but couldn't figure out the exact pattern.

Currently, we are just looking for exact string matches to remove it.



Solution 1:[1]

This (?<!, |,|^)"(?!,|$) , see: https://regex101.com/r/aXjeHV/1

Selects all double quotes that are:

  • not at the beginning of a line
  • not at the end of a line
  • not have a , after it
  • not have a , before it, and do not have a , (comma + space) before it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luuk