import Foundation
let pattern = #"(0-9]{5,6}[\t|\s]+sl-SI)[\r\n]"#
let regex = try! NSRegularExpression(pattern: pattern, options: .caseInsensitive)
let testString = #"""
Hello team,
We have dispatched a new job for you in GlobalLink.
Please see details below and kindly check the instructions field for each submission before you start working on it, as there could be special instructions in GL added by the client.
Translation task Deadline: please check in Junction task
Copy Edit task Deadline: please check in Junction task
Job Names **
Sub ID Lang
151097 sl-SI
151096 sr-RS
151094 da-DK
151093 tr-TR
151417 pt-BR
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"\n"#
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