I am trying to parse string data in Swift, the best solution that I can think of is using a regular expression. The problem is with detecting a substring with the pattern {{...}} The ... represents a string of any length. I created a regular expression using an online debugger. Here is the expression and the corresponding result:
But when I use same regular expression in Swift, it doesn't work. Below is the code that I am using.
if let match = data.range(of: "{{(.*)}}", options: .regularExpression)
{ some code logic }
But it is not working. I have hardcoded in the exact same string as in the test string above.