import Foundation
let pattern = #"<h(?:[\d]{1})(?:.*?)>(.*?)<\/h(?:[\d]{1})>"#
let regex = try! NSRegularExpression(pattern: pattern)
let testString = #"<h1 class="text-align-center" style="font-size:22px;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:IntroBold, sans-serif;line-height:1.5;letter-spacing:0px;font-weight:700;text-align:center;">You should be confident solving wicked problems in a hybrid role between strategy, research, design and business through a discovery driven approach. </h1><p></p><h2 style="margin-top:0px;margin-bottom:.5em;font-family:IntroBold, sans-serif;font-size:19px;line-height:1em;text-transform:uppercase;letter-spacing:1px;font-weight:700;"><strong>KEY RESPONSIBILITIES</strong></h2>"#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"<strong>$1</strong>"#
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