C++ Boost

Boost.Regex

Examples

Boost.Regex Index




Test Programs

regress:

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.

Directory: libs/regex/test/regress.

Files: basic_tests.cpp test_deprecated.cpp main.cpp.

bad_expression_test:

Verifies that "bad" regular expressions don't cause the matcher to go into infinite loops, but to throw an exception instead.

Directory: libs/regex/test/pathology.

Files: bad_expression_test.cpp.

recursion_test:

Verifies that the matcher can't overrun the stack (no matter what the expression).

Directory: libs/regex/test/pathology.

Files: recursion_test.cpp.

concepts:

Verifies that the library meets all documented concepts (a compile only test).

Directory: libs/regex/test/concepts.

Files: concept_check.cpp.

captures_test:

Test code for captures.

Directory: libs/test/captures.

Files: captures_test.cpp.

Example programs

grep

A simple grep implementation, run with the -h command line option to find out its usage.

Files: grep.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:

captures_example.cpp: Demonstrates the use of captures.

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_iterator_example.cpp: Iterating through a series of matches.

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_token_iterator_eg_1.cpp: split a string into a series of tokens.

regex_token_iterator_eg_2.cpp: enumerate the linked URL's in a HTML file.

The following are deprecated:

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_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  28 June 2004 

© Copyright John Maddock 1998- 2004

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)