대충 이런 느낌


#include "stdafx.h"
#include <iostream>
#include <string>
#include <regex>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
string s =  " ${HI} a ${BMADM} b${} c";

regex re("\\$\\{[^\\}]*\\}");

sregex_iterator i(
s.begin (),     
s.end (),     
re);
sregex_iterator j;
size_t pos=0;
for(; i!=j;++i) {
std::string pre_delimiter = s.substr(pos, (*i).position()-pos); 
std::cout << "pre_delimiter : " << pre_delimiter << std::endl;
std::cout << (*i).str() << std::endl;
pos = (*i).position() + (*i).size();
}
std::string last_delimiter = s.substr(pos);
std::cout << last_delimiter << std::endl;
return 0;
}

'C++' 카테고리의 다른 글

현재 프로그램 경로  (0) 2012.10.05
for_each 와 boost bind  (0) 2012.09.07
FireBreath  (0) 2012.08.10
c++ logging library  (0) 2012.08.08
wxWidgets 컴파일  (0) 2012.07.24
윈도우 폴더 관련  (0) 2012.07.24
wxWidgets tray icon (wxTaskBarIcon)  (0) 2012.07.24
taskbar gage (windows7 이상)  (0) 2012.07.24