I have this String:
let string = "Users: [Ricky], [Bob], [Jane]"
and I'm trying to make a string Array (Ex. ["Ricky","Bob","Jane"]
) with words that are wrapped by brackets.
Question: How do I substring and iterate results?
Is Regex the way to go?
let string = "Users: [Ricky], [Bob], [Jane]"
let pattern = "/[(.*?)]/"
let regex = try! NSRegularExpression(pattern: pattern)
let result = regex.matches(in:string, range:NSMakeRange(0, string.utf8.count))