import Foundation
let pattern = #"\\x"#
let regex = try! NSRegularExpression(pattern: pattern)
let testString = ##"callbackProxy({"7103/usatoday/high_impact/entertainment/main":{"_type_":"html","_expandable_":false,"_html_":"\x3chtml\x3e\x3chead\x3e\x3cstyle\x3e\x3c!--\na:link { color: #000000 }a:visited { color: #000000 }a:hover { color: #000000 }a:active { color: #000000 } --\x3e\x3c/style\x3e\x3cscript\x3e\x3c!--\n(function(){var d\x3d{};window.ss\x3dfunction(a){void 0!\x3d\x3dd[a]?d[a]++:d[a]\x3d1;var e\x3ddocument.getElementById(a),b\x3dd[a];if(window.css)css(a,\x22nm\x22,b,void 0,void 0)"##
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #"\u00"#
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