I try to get urls in text. So befor I used such expression
let re = NSRegularExpression(pattern: "https?:\\/.*", options: nil, error: nil)!
But I had a problem, when user input urls with Capitalized symbols like it doesn't match it ( I tried
let re = NSRegularExpression(pattern: "(h|H)(t|T)(t|T)(p|P)s?:\\/.*", options: nil, error: nil)!
But nothing happend.
Best How To :
You turn off case sensitivity using an
i inline flag in regex:
See Foundation Framework Reference for more information on available regex features.
Flag settings. Change the flag settings. Changes apply to the portion of the pattern following the setting. For example, (?i) changes to a case insensitive match.The flags are defined in Flag Options.