Мне нужно найти несколько ссылок в строке. Я использую регулярное выражение
(https?:\/\/.*\.(?:png|jpg))
и строка Newhttps://www.findregexhere.com/newimage.pngfrhttps://www.findregexhere.com/newimage.pngnewimage
Вот код, который я использую
let regex = try NSRegularExpression(pattern: "https?:\/\/.*\.(?:png|jpg)$", options: .caseInsensitive)
let nsString = text as NSString
let results = regex.matches(in: text, range: NSRange(location: 0, length: nsString.length))
но результат дает мне это
https://www.findregexhere.com/newimage.pngfrhttps://www.findregexhere.com/newimage.png