I am trying to write some code to regex search against wide strings. The problem I am having is that the regex operations ( regex_search
in particular ) does not take in wide arguements. Here is the snippet I am having trouble with:
Function Header:
void scan_filesystem( wpath const& f, wregex const& reg, unsigned i = 0 )
Snippet:
while ( !fileStream.eof() ) {
vector<wstring> tokens;
wstring line;
getline( fileStream, line );
wistringstream iss( line );
copy( istream_iterator<wstring, wchar_t, char_traits<wchar_t>>(iss),
istream_iterator<wstring, wchar_t, char_traits<wchar_t>>(),
back_inserter< vector<wstring> >(tokens));
auto it = tokens.cbegin();
auto end = tokens.cend();
wsmatch m;
while ( regex_search( it, end, m, reg ) ){
}
int br =0;
}
Any suggestions on how to regex_search
with wide arguements would be greatly appreciated!