Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Boost.Regex

Examples




There are three demo applications that ship with this library, they all come with makefiles for Borland, Microsoft and gcc compilers, otherwise you will have to create your own makefiles.

regress.exe:

A regression test application that gives the matching/searching algorithms a full workout. The presence of this program is your guarantee that the library will behave as claimed - at least as far as those items tested are concerned - if anyone spots anything that isn't being tested I'd be glad to hear about it.

Files: parse.cpp, regress.cpp, tests.cpp.

jgrep.exe

A simple grep implementation, run with no command line options to find out its usage. Look at fileiter.cpp/fileiter.hpp and the mapfile class to see an example of a "smart" bidirectional iterator that can be used with boost.regex or any other STL algorithm.

Files: jgrep.cpp, main.cpp.

timer.exe

A simple interactive expression matching application, the results of all matches are timed, allowing the programmer to optimize their regular expressions where performance is critical.

Files: regex_timer.cpp.

Code snippets

The snippets examples contain the code examples used in the documentation:

credit_card_example.cpp: Credit card number formatting code.

partial_regex_grep.cpp: Search example using partial matches.

partial_regex_match.cpp: regex_match example using partial matches.

regex_grep_example_1.cpp: regex_grep example 1: searches a cpp file for class definitions.

regex_grep_example_2.cpp: regex_grep example 2: searches a cpp file for class definitions, using a global callback function.

regex_grep_example_3.cpp: regex_grep example 2: searches a cpp file for class definitions, using a bound member function callback.

regex_grep_example_4.cpp: regex_grep example 2: searches a cpp file for class definitions, using a C++ Builder closure as a callback.

regex_match_example.cpp: ftp based regex_match example.

regex_merge_example.cpp: regex_merge example: converts a C++ file to syntax highlighted HTML.

regex_replace_example.cpp: regex_replace example: converts a C++ file to syntax highlighted HTML

regex_search_example.cpp: regex_search example: searches a cpp file for class definitions.

regex_split_example_1.cpp: regex_split example: split a string into tokens.

regex_split_example_2.cpp : regex_split example: spit out linked URL's.


Revised 24 Oct 2003

© Copyright John Maddock 1998- 2003

Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)