Powered by |
Adding regular expressions support for VC++ projectRegular expressions is an essential part of nowadays programming. Regular expressions is a powerful tool for text and data parsing and manipulating of any kind. Forget about hassles and head scratching while writing another parsing function. Get familiar with regular expressions and feel the difference! C++ standard does not declare regular expressions support so far (2004). But there are some libraries out there which implement required functionality pretty well. Regex from boost.org is one of them. Let's check how you can add a regular expressions support to your project using boost.org Regex library. Boost.org is an Open Source project and has a bunch of libraries within itself. You can download its source code from sourceforge.net. Do not search for binaries, you have to build them yourself (if required). Here I'll describe my experience using Boost Regex for Visual C++ project. I was using particularly Microsoft Visual C++ .NET, version 7.1 (as a part of Microsoft Visual Studio .NET 2003). Step 1. Download the library source code (*.zip file). At the moment of writing Boost library has version 1.31.0 released Feb. 2004. Usually the archive includes all libraries from Boost project and is rather big. It also includes documentation and installation instructions. Extract the file to any temporary location. You'll find some folders and files, we'll need only some of them. BOOST DOC LIBS MORE PEOPLE STATUS TOOLS boost.css boost-build.jam "c++boost.gif" google_logo_40wht.gif index.htm Jamfile Jamfile.v2 Jamrules LICENSE_1_0.txt project-root.jam README rst.css Step 2. Copy \Program Files\Microsoft Visual Studio .NET 2003\Vc7\include Starting from this point you can include Boost regex header into your source code like this: #include "boost/regex.hpp" The code will compile but won't link yet. To get it linked and running we need *.lib files and *.dll-s if library will be linked dynamically. Remember: Boost is not only regualar expressions. There is a bunch of useful stuff in it like iterators, smart pointers, algorithms, math and more ... Step 3. Copy Step 4. To build lib and dll files we need Locate
|