import Foundation
let pattern = #"^.+?\K(\,)"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
2009 CITROEN BERLINGO FIRST HDI 1.6 DIESEL, Cherry Red, PAS, Rear sliding doors, Locally owned .......................................NOW SOLD
2012 FORD GRAND C-MAX ZETEC 1.6 PETROL, 47,574 Miles, 1 Owner from New, 7 Seater...................................WAS £6,995 NOW £6,495!
2007 JEEP CHEROKEE SRI CD LIMITED EDITION, Sat Nav/ Radio, Leather Heated Seats ......................................................................SOLD!
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"\t"#
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