Slide 53
Slide 53 text
func getMatches(in line: String) throws -> [TextCheckingResult] {
let pattern = "WFLocalizedString\\(@\"([^\"]*)\"\\)"
let regex = try RegularExpression(pattern: pattern, options: [])
let matches = regex.matches(in: line, options: [], range: NSRange(location: 0, length: line.utf16.count))
if matches.count > 0 {
return matches
}
let descriptivePattern = "WFLocalizedStringWithDescription\\(@\"([^\"]*)\", @\"([^\"]*)\"\\)"
let descriptiveRegex = try RegularExpression(pattern: descriptivePattern, options: [])
return descriptiveRegex.matches(in: line, options: [], range: NSRange(location: 0, length: line.utf16.count))
}