0
Я пытаюсь соответствовать всей MP3S ссылке в HTMLRegex найти mp3 файл HTML
ожидаемых выходного
http://mp3cofe.com/ariana-grande-weeknd-love-me-harder-andreevskiy-remix.mp3
http://mp3cofe.com/listen/52d-remix.mp3
получает выход
http://mp3cofe.com/ariana-grande-weeknd-love-me-harder-andreevskiy-remix.mp3" rel="nofollow" target="_blank" style="color:green;">Download</a</div><a href="http://mp3cofe.com/listen/52d-remix.mp3"
код
#include <iostream>
#include <string>
#include <regex>
int main(){
std::string subject("<a href=\"http://mp3cofe.com/ariana-grande-weeknd-love-me-harder-andreevskiy-remix.mp3\" rel=\"nofollow\" target=\"_blank\" style=\"color:green;\">Download</a></div><a href=\"http://mp3cofe.com/listen/52d-remix.mp3\" rel=\"nofollow\" target=\"_blank\" style=\"color:green;\">Download</a> ");
std::regex re("(http:\/\/)(.*)(\.mp3\"\)");
std::sregex_iterator next(subject.begin(), subject.end(), re);
std::sregex_iterator end;
while (next != end) {
std::smatch match = *next;
std::cout << match.str() << "\n";
next++;
}
return 0;
}
избежать обратной косой черты, если это необходимо .. –
или использовать '\\ S *' вместо '(. *?)' –
Почему downvote? –