Ok I need some fast help with this, I'm trying to get a regular expression to work with my file system. this is what i currently have, but it seem to crash on, boost::regex expr(regex);
void show_files (const path & directory, bool recurse_into_subdirs, bool lSwitch, bool rSwitch, bool aSwitch, string regex)
{
cout << "in function" << endl;
boost::regex expr(regex);
cout << "set regex" << endl;
if(exists(directory))
{
directory_iterator end ;
for(directory_iterator iter(directory) ; iter != end ; ++iter)
if (!is_directory(*iter))
{
cout << "in file if" << endl;
string s(iter->leaf());
cout << "set string" << endl;
bool isMatch = boost::regex_match(s, expr);
cout << "matched regex" << endl;
if(isMatch == true){
cout << "in isMatch if" << endl;
cout << (lSwitch == true?"\n-: ":"\n ") << setw(15) << right << file_size(iter->path()) << " " << iter->leaf() ;
cout << "finsihed" << endl;
}
}
else
{
cout << (lSwitch == true?"\nd: ":"\n ") << setw(15) << right << "" << " " << iter->leaf() << "/" ;
if(recurse_into_subdirs) show_files(*iter, recurse_into_subdirs, lSwitch, rSwitch, aSwitch, regex) ;
}
}
}