Skip to content

Instantly share code, notes, and snippets.

@Santarh
Created June 29, 2012 09:46
Show Gist options
  • Save Santarh/3016963 to your computer and use it in GitHub Desktop.
Save Santarh/3016963 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <boost/regex.hpp>
int main()
{
std::string file_path = "/foo/bar/bunny.obj";
std::string type = "unknown";
boost::regex rx_find_extension("([^\\.]+)$");
boost::smatch result;
if ( boost::regex_match( file_path, result, rx_find_extension ) )
{
type = result.str(1);
}
std::cout << type << std::endl;
}
@Santarh
Copy link
Author

Santarh commented Jun 29, 2012

// output
unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment