using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d),(\d)(?!(([^""]+""){2})*[^""]+$)";
string substitution = @"$1$2";
string input = @"1,Hershey's,10268,1305178,Reese_Core_THC_FY_Brand_Campaign_2023,video,in-app,Mobile In-App Video,3,RELATED_PINS,""32,860"",98.40%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,533,1.60%,1.60%,""32,860"",""33,393"",0.70%,""4,710,648"",99.30%,""4,744,041"",""4,744,041""
2,Hipp GmbH & Co. Vertrieb KG,16800,1546599,ES151635_HiPP_FoMi Flight 2 2023_CPCV,video,in-app,Mobile In-App Video,3,RELATED_PINS,""29,758"",98.12%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,569,1.88%,1.88%,""29,758"",""30,327"",3.08%,""954,365"",96.92%,""984,692"",""984,692""
3,Kimberly Clark,3751,1554555,KK_KHW_226_KOT_RCH-ST_Q3 23_HWL_P2DNXD0_P18-39_OFH,video,in-app,Mobile In-App Video,3,RELATED_PINS,""24,727"",98.28%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,433,1.72%,1.72%,""24,727"",""25,160"",0.64%,""3,898,750"",99.36%,""3,923,910"",""3,923,910""
4,Kimberly Clark,3751,1554527,KK_CFT _303_HUG_RCH_Q3 23_CFT _P2DNR3G_AB_EST,display,in-app,Mobile App,3,RELATED_PINS,""23,963"",98.78%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,295,1.22%,1.22%,""23,963"",""24,258"",0.57%,""4,229,318"",99.43%,""4,253,576"",""4,253,576""
5,Kimberly Clark,3751,1554527,KK_CFT _303_HUG_RCH_Q3 23_CFT _P2DNR3G_AB_EST,display,in-app,Mobile In-App,3,RELATED_PINS,""23,963"",98.78%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,295,1.22%,1.22%,""23,963"",""24,258"",0.57%,""4,229,318"",99.43%,""4,253,576"",""4,253,576""
6,Bayer Vital GmbH,17072,1268855,2023_03_DE_Lefax-Intens_Consumer_Tactical_Social_Intens_PO2151230403,video,in-app,Mobile In-App Video,3,RELATED_PINS,""21,697"",98.23%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,390,1.77%,1.77%,""21,697"",""22,087"",3.88%,""547,359"",96.12%,""569,446"",""569,446""
7,Ferrero DE (FERRERO MSC GmbH & Co. KG),13924,1531938,DE_W25_W28_FY23_IYO_DigitalVideoI_AWE_CI~69374_Aktion-Pinterest-IYO-TIII-FY2223-DigitalVideo-StandardVideo_Awareness_Auction,video,in-app,Mobile In-App Video,5,HOME_FEED,""20,938"",98.13%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,400,1.87%,1.87%,""20,938"",""21,338"",2.22%,""940,902"",97.78%,""962,240"",""962,240""
8,Pernod Ricard UK,8897,1556116,BRE_FLIP_Summer24_W1_07-22_views_soc_product-launch_pin_GBR_omnet_x_x,display,in-app,Mobile App,3,RELATED_PINS,""19,536"",98.16%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,366,1.84%,1.84%,""19,536"",""19,902"",1.50%,""1,305,872"",98.50%,""1,325,774"",""1,325,774""
9,Pernod Ricard UK,8897,1556116,BRE_FLIP_Summer24_W1_07-22_views_soc_product-launch_pin_GBR_omnet_x_x,display,in-app,Mobile In-App,3,RELATED_PINS,""19,536"",98.16%,0,0,0.00%,0,0.00%,0,0.00%,0,0.00%,366,1.84%,1.84%,""19,536"",""19,902"",1.50%,""1,305,872"",98.50%,""1,325,774"",""1,325,774""";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx