import Foundation
let pattern = #"(.*:.*)(')(.*)(')},$"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
"_v":[{ "CardTemplate": 56 },{ "CardAbilityContainer": 1 },{ "TemplateOverrideValues": 1 },{ "CardTemplateLayout": 5 },{ "SerializableTAC": 1 }],
"_t":"Reckoning.Game.CardTemplate", "m_Id" : {
"m_Guid" : '92807f9d-8b5c-4c59-a46f-61a5c68c3776'},
"m_SetId" : {
"m_Guid" : 'fce480eb-15f9-4096-8d12-6beee9118652'},
"m_DesignerCardId" : "HEX_000995",
"m_Name" : "Zin'xith Silk",
"m_CardNumber" : 5,
"m_Tradeable" : 1,
"m_Faction" : "None",
"m_SocketCount" : 0,
"m_AttributeFlags" : "Unknown",
"m_ColorFlags" : "Colorless",
"m_ResourceCost" : 0,
"m_Threshold" : [],
"m_CardImagePath" : "Sets\\_ArtSource\\PVP0003\\a0001516.png",
"m_CardType" : "Resource",
"m_CardSubtype" : "",
"m_BaseAttackValue" : 0,
"m_BaseHealthValue" : 0,
"m_FlavorText" : "",
"m_CardRarity" : "Rare",
"m_LineageId" : {
"m_Guid" : '00000000-0000-0000-0000-000000000000'},
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"$1"$3"},"#
let result = regex.stringByReplacingMatches(in: testString, range: stringRange, withTemplate: substitutionString)
print(result)
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 Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression