Home > Mobile >  How to remove quote?
How to remove quote?

Time:03-31

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.

CodePudding user response:

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.
  • Related