Function extractMatchingRegex
Synopsis
#include <include/bitextractor.hpp>
void extractMatchingRegex(const wstring &in_file, const wstring ®ex, const wstring &out_dir) const
Description
Extracts the regex matching files in the given archive into the choosen directory.
- Note
- Available only when compiling bit7z using the BIT7Z_REGEX_MATCHING preprocessor define.
- Parameters
in_file
- the input archive file.regex
- the regex used for matching the paths of files inside the archive.out_dir
- the output directory where extracted files will be put.
Source
Lines 63-72 in src/bitextractor.cpp. Line 81 in include/bitextractor.hpp.
void BitExtractor::extractMatchingRegex( const wstring& in_file, const wstring& regex, const wstring& out_dir ) const {
if ( regex.empty() ) {
throw BitException( "Empty regex filter", E_INVALIDARG );
}
const wregex regex_filter( regex, std::regex::ECMAScript | std::regex::optimize );
extractMatchingFilter( in_file, out_dir, [ ®ex_filter ]( const wstring& item_path ) -> bool {
return std::regex_match( item_path, regex_filter );
});
}