Use of compression library: See for example code using zlib library: http://www.zlib.net/zlib_how.html From zlib.h we use the basic compression functions deflateInit(), deflate(), and deflateEnd(), and the basic decompression functions inflateInit(), inflate(), and inflateEnd(). The def() routine compresses data from an input file to an output file. The output data will be in the zlib format, which is different from the gzip or zip formats. The zlib format has a very small header of only two bytes to identify it as a zlib stream and to provide decoding information, and a four-byte trailer with a fast check value to verify the integrity of the uncompressed data after decoding. zlib has liberal license term. No issues. zlib header file is zlib.h Note: zip header file is zip.h (which is different beast) Used to read/create zip archives. Homepage: http://www.nih.at/libzip/ What about regex ?