http://cpplover.blogspot.jp/2015/01/c-stdregex.html
このサイトを見ながら正規表現を使おうとしています。
そこで
http://melpon.org/wandbox/permlink/QORbjvx6GLwIMrkY
cpp
1#include <string> 2#include <vector> 3#include <regex> 4#include <iostream> 5 6template<typename char_type> 7std::vector<std::basic_string<char_type>> list(std::basic_string<char_type> const & text, std::basic_regex<char_type> const & re) 8{ 9 std::vector<std::basic_string<char_type>> result; 10 std::match_results<typename std::basic_string<char_type>::const_iterator> m; // match_results 11 std::regex_match(text, m, re); 12 for (auto && elem : m) {// elemはsub_match 13 result.push_back(elem.str()); 14 } 15 return result; 16} 17int main() 18{ 19 for (auto&& i : list( 20 std::wstring(LR"( <a href="/2_86347/gwCabinet/list?currentFolderId=1089815" class="iconLink categoryLink" title="みらい研2015 6月期 ブース配置">)"), 21 std::wregex(LR"(gwCabinet\/list\?currentFolderId=(\d+).*" class="iconLink categoryLink" title="(.+).*")") 22 )) { 23 std::wcout << i << std::endl; 24 } 25}
のようなコードを書いたのですが、どうもマッチしてくれません。何が原因なのでしょうか?
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。