import Foundation
let pattern = #"(([1-4]\d|[5-9])\d*)\+$"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 6+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 7+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 8+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 9+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 10+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 11+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 51+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 61+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 81+
HP 400 PROONE İ3-4130T 4GB 500GB 19.5" OB DO 792,40 679,20 582,98 USD 1.462,70 18 4+
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"\1"#
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