If you have filtered out the correct rows and the structure of the string is the same you can use lastIndex(of:) and firstIndex(of:) functions to find the inner <> pair and then extract a substring from that
if let first = str.lastIndex(of:"<"), let last = str.firstIndex(of:">") {
let name = String(str[str.index(after: first)..<last])
}
Example
let strings = ["<div class=\"name\" title=\""User" <John Appleseed>\">", "<div class=\"name\" title=\""User" <Bill Gates>\">"]
for str in strings {
if let first = str.lastIndex(of:"<"), let last = str.firstIndex(of:">") {
let name = String(str[str.index(after: first)..<last])
print(name)
}
}
produces
John Appleseed
Bill Gates
<John Appleseed>from<div>if you didn't know HTML?<John Appleseed>is inside quotes. Will that always be the case? If so, you could make use of that. 2) You could make a list of known html tags to distinguish between actual and seeming html tags 3) parse the HTML and then find strings inside tags (which then aren't real html tags).<[\w\s]+>as starting point using regexpal.com (or similar). Depending on how similar the elements in the array are, that may be it already.