2003-05-17 11:45:48 +00:00
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<title>Boost.Regex: Examples</title>
|
|
|
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<p></p>
|
|
|
|
|
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" width="300">
|
2004-10-05 15:45:52 +00:00
|
|
|
|
<h3><a href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../boost.png" width="277" border="0"></a></h3>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
</td>
|
|
|
|
|
<td width="353">
|
|
|
|
|
<h1 align="center">Boost.Regex</h1>
|
|
|
|
|
<h2 align="center">Examples</h2>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50">
|
|
|
|
|
<h3><a href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></a></h3>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
<BR>
|
|
|
|
|
<BR>
|
|
|
|
|
<HR>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<H3>Test Programs</H3>
|
|
|
|
|
<H4>regress:</H4>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
<P>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.</P>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<P>Directory: <A href="../test/regress">libs/regex/test/regress</A>.</P>
|
|
|
|
|
<P>Files: <A href="../test/regress/basic_tests.cpp">basic_tests.cpp</A> <A href="../test/regress/test_deprecated.cpp">
|
|
|
|
|
test_deprecated.cpp</A> <A href="../test/regress/main.cpp">main.cpp</A>.</P>
|
|
|
|
|
<H4>bad_expression_test:</H4>
|
|
|
|
|
<P>Verifies that "bad" regular expressions don't cause the matcher to go into
|
|
|
|
|
infinite loops, but to throw an exception instead.</P>
|
|
|
|
|
<P>Directory: <A href="../test/pathology">libs/regex/test/pathology</A>.</P>
|
|
|
|
|
<P>Files: <A href="../test/pathology/bad_expression_test.cpp">bad_expression_test.cpp</A>.</P>
|
|
|
|
|
<H4>recursion_test:</H4>
|
|
|
|
|
<P>Verifies that the matcher can't overrun the stack (no matter what the
|
|
|
|
|
expression).</P>
|
|
|
|
|
<P>Directory: <A href="../test/pathology">libs/regex/test/pathology</A>.</P>
|
|
|
|
|
<P>Files: <A href="../test/pathology/recursion_test.cpp">recursion_test.cpp</A>.</P>
|
|
|
|
|
<H4>concepts:</H4>
|
|
|
|
|
<P>Verifies that the library meets all documented concepts (a compile only test).</P>
|
|
|
|
|
<P>Directory: <A href="../test/concepts">libs/regex/test/concepts</A>.</P>
|
|
|
|
|
<P>Files: <A href="../test/concepts/concept_check.cpp">concept_check.cpp</A>.</P>
|
|
|
|
|
<H4>captures_test:</H4>
|
|
|
|
|
<P>Test code for captures.</P>
|
|
|
|
|
<P>Directory: <A href="../test/captures">libs/test/captures</A>.</P>
|
|
|
|
|
<P>Files: <A href="../test/captures/captures_test.cpp">captures_test.cpp</A>.</P>
|
|
|
|
|
<H3>Example programs</H3>
|
2005-01-15 12:29:59 +00:00
|
|
|
|
<H4>grep</H4>
|
|
|
|
|
<P>A simple grep implementation, run with the -h command line option to find out
|
|
|
|
|
its usage.</P>
|
|
|
|
|
<P>Files: <A href="../example/grep/grep.cpp">grep.cpp</A></P>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<H4>timer.exe</H4>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
<P>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.</P>
|
|
|
|
|
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.</P>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<H4>Code snippets</H4>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
<P>The snippets examples contain the code examples used in the documentation:</P>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<P><A href="../example/snippets/captures_example.cpp">captures_example.cpp</A>:
|
|
|
|
|
Demonstrates the use of captures.</P>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
<P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
|
|
|
|
|
Credit card number formatting code.</P>
|
|
|
|
|
<P><A href="../example/snippets/partial_regex_grep.cpp">partial_regex_grep.cpp</A>:
|
|
|
|
|
Search example using partial matches.</P>
|
|
|
|
|
<P><A href="../example/snippets/partial_regex_match.cpp">partial_regex_match.cpp</A>:
|
|
|
|
|
regex_match example using partial matches.</P>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<P><A href="../example/snippets/regex_iterator_example.cpp">regex_iterator_example.cpp</A>:
|
|
|
|
|
Iterating through a series of matches.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_match_example.cpp">regex_match_example.cpp</A>:
|
|
|
|
|
ftp based regex_match example.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_merge_example.cpp">regex_merge_example.cpp</A>:
|
|
|
|
|
regex_merge example: converts a C++ file to syntax highlighted HTML.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_replace_example.cpp">regex_replace_example.cpp</A>:
|
|
|
|
|
regex_replace example: converts a C++ file to syntax highlighted HTML</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_search_example.cpp">regex_search_example.cpp</A>:
|
|
|
|
|
regex_search example: searches a cpp file for class definitions.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_token_iterator_eg_1.cpp">regex_token_iterator_eg_1.cpp</A>:
|
|
|
|
|
split a string into a series of tokens.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_token_iterator_eg_2.cpp">regex_token_iterator_eg_2.cpp</A>:
|
|
|
|
|
enumerate the linked URL's in a HTML file.</P>
|
|
|
|
|
<P>The following are deprecated:</P>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
<P><A href="../example/snippets/regex_grep_example_1.cpp">regex_grep_example_1.cpp</A>:
|
|
|
|
|
regex_grep example 1: searches a cpp file for class definitions.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_grep_example_2.cpp">regex_grep_example_2.cpp</A>:
|
|
|
|
|
regex_grep example 2: searches a cpp file for class definitions, using a global
|
|
|
|
|
callback function.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_grep_example_3.cpp">regex_grep_example_3.cpp</A>:
|
|
|
|
|
regex_grep example 2: searches a cpp file for class definitions, using a bound
|
|
|
|
|
member function callback.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_grep_example_4.cpp">regex_grep_example_4.cpp</A>:
|
|
|
|
|
regex_grep example 2: searches a cpp file for class definitions, using a C++
|
|
|
|
|
Builder closure as a callback.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_split_example_1.cpp">regex_split_example_1.cpp</A>:
|
|
|
|
|
regex_split example: split a string into tokens.</P>
|
|
|
|
|
<P><A href="../example/snippets/regex_split_example_2.cpp">regex_split_example_2.cpp</A>
|
|
|
|
|
: regex_split example: spit out linked URL's.</P>
|
|
|
|
|
<P></P>
|
|
|
|
|
<HR>
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<p>Revised
|
2003-10-24 10:51:38 +00:00
|
|
|
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
2005-01-13 17:06:21 +00:00
|
|
|
|
28 June 2004
|
2003-10-24 10:51:38 +00:00
|
|
|
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
|
|
|
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
2005-01-13 17:06:21 +00:00
|
|
|
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
2003-10-24 10:51:38 +00:00
|
|
|
|
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
|
|
|
|
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
|
|
|
|
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
2003-05-17 11:45:48 +00:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|