Boost logo

Boost Users :

From: Rich Johnson (rjohnson_at_[hidden])
Date: 2004-01-11 13:19:31


I'm new to regex and would like to use it to match filenames, but I'd
like to stick with a csh/bash syntax.
Is this advisable?
If so, would anyone have a set of regex traits for this syntax?
If not, could someone point me in the right direction?

Thanks,
--rich

An sample usage is:

     namespace fs = boost::filesystem

     char * dirname;
     /*...glob_regex_traits definition */
     boost::regex expr( "*.cpp" , /*...glob_regex_traits...*/ );

     for( fs::directory_iterator iter( fs:path( dirname ) )
                 ; iter != fs::directory_iterator()
                 ; ++iter
            )
     {
        boost::cmatch match_data
        if( regex_match( iter->leaf().c_str(), match_data, expr ) )
        {
                /*...do something...*/
        }
     }

        


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net