I have a problem and cannot figure out what to do.
Question: I need to remove a double quote, inside double quotes
String example:
"MIKE YANICK","412 A AVE "E"," ","NADIEN PA"," ","190445468"
As you can see, the letter E inside "412 A AVE "E" has an extra double quote.
I need to remove it.
Here is what my outcome should be:
"MIKE YANICK","412 A AVE E"," ","NADIEN PA"," ","190445468"
Please help...
You could use a regular expression like this:
(?<!(^|,))"(?!(,|$))
This will match any double quote ("
) that isn't proceeded by the start of the string, or a comma, and isn't followed by a comma or the end of the string.
This works with your example:
Regex.Replace("\"MIKE YANICK\",\"412 A AVE \"E\",\" \",\"NADIEN PA\",\" \",\"190445468\"",
"(?<=\")([^,]*)(?=\")",
m => m.Value.Replace("\"", string.Empty)) ;
Output:
"MIKE YANICK","412 A AVE E"," ","NADIEN PA"," ","190445468"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With