Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-07-26 20:18:36


Author: dgregor
Date: 2007-07-26 20:18:35 EDT (Thu, 26 Jul 2007)
New Revision: 7560
URL: http://svn.boost.org/trac/boost/changeset/7560

Log:
Fix eol-style and mime-types
Properties modified:
   sandbox/SOC/2007/regex/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/Jamrules (props changed)
   sandbox/SOC/2007/regex/README (props changed)
   sandbox/SOC/2007/regex/boost-build.jam (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/cregex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex.h (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/concepts.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/config.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/config/borland.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/config/cwchar.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/icu.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/mfc.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/pattern_except.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/pending/object_cache.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/pending/static_mutex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/pending/unicode_iterator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/user.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/basic_regex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/basic_regex_creator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/basic_regex_parser.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/c_regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/char_regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/cpp_regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/cregex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/error_type.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/fileiter.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/instances.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/iterator_category.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/iterator_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/match_flags.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/match_results.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/mem_block_cache.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/perl_matcher.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/perl_matcher_common.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/perl_matcher_non_recursive.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/perl_matcher_recursive.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/primary_transform.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/protected_call.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regbase.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_cstring.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_format.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_fwd.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_grep.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_iterator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_kmp.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_match.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_merge.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_raw_buffer.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_replace.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_search.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_split.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_stack.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_token_iterator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_traits_defaults.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/regex_workaround.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/states.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/sub_match.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/syntax_type.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/u32regex_iterator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/u32regex_token_iterator.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex/v4/w32_regex_traits.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/boost/regex_fwd.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/bc_gen.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/common.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/gcc_gen.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/generic_gen.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/sun_gen.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/build/vc_gen.sh (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/bad_expression.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/basic_regex.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/captures.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/character_class_names.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/collating_names.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/concepts.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/configuration.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/contacts.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/error_type.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/examples.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/faq.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/format_boost_syntax.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/format_perl_syntax.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/format_sed_syntax.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/format_syntax.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/gcc-performance.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/headers.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/history.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/icu_strings.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/implementation.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/index.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/install.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/introduction.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/localisation.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/match_flag_type.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/match_results.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/mfc_strings.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/non_standard_strings.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/partial_matches.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/performance.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/posix_api.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/redistributables.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/reg_expression.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regbase.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_format.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_grep.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_iterator.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_match.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_merge.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_replace.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_search.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_split.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_token_iterator.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/regex_traits.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/standards.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/sub_match.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax_basic.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax_extended.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax_leftmost_longest.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax_option_type.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/syntax_perl.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/thread_safety.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/unicode.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/doc/vc71-performance.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/grep/grep.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/captures_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/credit_card_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/icu_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/mfc_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/partial_regex_grep.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/partial_regex_match.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_grep_example_1.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_grep_example_2.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_grep_example_3.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_grep_example_4.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_iterator_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_match_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_merge_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_replace_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_search_example.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_split_example_1.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_split_example_2.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_token_iterator_eg_1.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/snippets/regex_token_iterator_eg_2.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/timer/input_script.txt (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/example/timer/regex_timer.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/index.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/command_line.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/input.html (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/main.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/regex_comparison.hpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_boost.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_dynamic_xpressive.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_greta.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_localised_boost.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_pcre.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_posix.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/performance/time_safe_greta.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/readme.txt (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/c_regex_traits.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/cpp_regex_traits.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/cregex.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/fileiter.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/icu.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/instances.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/posix_api.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/regex.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/regex_debug.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/regex_raw_buffer.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/regex_traits_defaults.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/static_mutex.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/usinstances.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/w32_regex_traits.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/wc_regex_traits.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/wide_posix_api.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/src/winstances.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/c_compiler_checks/posix_api_check.c (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/c_compiler_checks/posix_api_check.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/c_compiler_checks/wide_posix_api_check.c (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/c_compiler_checks/wide_posix_api_check.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/captures/Jamfile.v2 (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/captures/captures_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/collate_info/collate_info.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/concepts/concept_check.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/concepts/icu_concept_check.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/config_info/regex_config_info.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/object_cache/object_cache_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/pathology/bad_expression_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/pathology/recursion_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/profile/Makefile (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/static_mutex/static_mutex_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/unicode/unicode_iterator_test.cpp (props changed)
   sandbox/SOC/2007/regex/named-captures/libs/regex/tools/generate/tables.cpp (props changed)
   sandbox/SOC/2007/regex/project-root.jam (props changed)
   sandbox/SOC/2007/regex/test_named_captures.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/regex/test_named_captures.cpp | 168 ++++++++++++++++++++--------------------
   1 files changed, 84 insertions(+), 84 deletions(-)

Modified: sandbox/SOC/2007/regex/test_named_captures.cpp
==============================================================================
--- sandbox/SOC/2007/regex/test_named_captures.cpp (original)
+++ sandbox/SOC/2007/regex/test_named_captures.cpp 2007-07-26 20:18:35 EDT (Thu, 26 Jul 2007)
@@ -1,85 +1,85 @@
-#include <iostream>
-#include <boost/regex.hpp>
-
-using namespace std;
-using namespace boost;
-
-void test_named_captures(const string& pattern, const string& text)
-{
- regex ex(pattern);
- smatch matches;
- if (regex_match(text, matches, ex, match_extra))
- cout << pattern << " matches " << text << endl;
- else
- cout << pattern << " does not match " << text << endl;
-}
-
-void test_named_groups()
-{
- test_named_captures("(?P<alpha>a)", "a");
- test_named_captures("(?P<alpha>abc)+", "abcabc");
- test_named_captures("(?P<alpha>a+)(b+)", "aaabbb");
- test_named_captures("(a+)(?P<beta>b+)", "aaabbb");
- test_named_captures("(?P<outer>(a+)b+)", "aaabbb");
- test_named_captures("(?P<outer>a+(b+))", "aaabbb");
- test_named_captures("(a+(?P<inner>b+))", "aaabbb");
- test_named_captures("(?P<outer>a+(?P<inner>b+))", "aaabbb");
- test_named_captures("a+(?P<inSiDe>b+)b+", "aaadzabbb"); //should fail
- test_named_captures("(a)(?P<alt>b|$)", "ab");
- test_named_captures("(a)(?P<alt>b|$)", "a");
-}
-
-void test_named_retrieval()
-{
- smatch matches;
- regex ad("got (?P<drink>\\w+)\\?$");
- string text = "got milk?";
- if (regex_match(text, matches, ad, match_extra) && matches["drink"] == "milk")
- cout << "passed ad\n";
- else
- cout << "failed ad\n";
-
- regex magic("(?P<first>abra)ca(?P<second>dabra)!");
- text = "abracadabra!";
- if (regex_match(text, matches, magic, match_extra) && matches["first"] == "abra" && matches["second"] == "dabra")
- cout << "passed magic\n";
- else
- cout << "failed magic\n";
-
- regex poem("(?P<first>.*), (\\w+) (?P<second>.*) D.*");
- text = "Twas brillig, and the slithy toves Did gyre and gimble in the wabe";
- if (regex_match(text, matches, poem, match_extra) &&
- matches["first"] == "Twas brillig" && matches["second"] == "the slithy toves" &&
- matches["second"] == matches[3])
- cout << "passed poem\n";
- else
- cout << "failed poem\n";
-}
-
-void test_named_backrefs()
-{
- test_named_captures("(?P<alpha>a)bc(?P=alpha)", "abca");
- test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabcaaa");
- test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabca"); //should fail
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abb");
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "add");
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abd"); //should fail
- test_named_captures("(?P<name>\\w+) (.*) (?P=name)", "Jameson R. Jameson");
- test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbbb");
- test_named_captures("(a+(?P<inner>b+))c(?P=inner)", "aabcb");
- test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbb"); //should fail
- test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
- test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
- // the two below should (and do) cause runtime errors when the pattern compiles
- //test_named_captures("(?P=alpha)", "abca"); //should fail
- //test_named_captures("(?P=<alpha>.*)(?=beta)", "abab"); //should fail
-}
-
-int main(int argc, char * argv[])
-{
- test_named_groups();
- test_named_retrieval();
- test_named_backrefs();
-
- return 0;
+#include <iostream>
+#include <boost/regex.hpp>
+
+using namespace std;
+using namespace boost;
+
+void test_named_captures(const string& pattern, const string& text)
+{
+ regex ex(pattern);
+ smatch matches;
+ if (regex_match(text, matches, ex, match_extra))
+ cout << pattern << " matches " << text << endl;
+ else
+ cout << pattern << " does not match " << text << endl;
+}
+
+void test_named_groups()
+{
+ test_named_captures("(?P<alpha>a)", "a");
+ test_named_captures("(?P<alpha>abc)+", "abcabc");
+ test_named_captures("(?P<alpha>a+)(b+)", "aaabbb");
+ test_named_captures("(a+)(?P<beta>b+)", "aaabbb");
+ test_named_captures("(?P<outer>(a+)b+)", "aaabbb");
+ test_named_captures("(?P<outer>a+(b+))", "aaabbb");
+ test_named_captures("(a+(?P<inner>b+))", "aaabbb");
+ test_named_captures("(?P<outer>a+(?P<inner>b+))", "aaabbb");
+ test_named_captures("a+(?P<inSiDe>b+)b+", "aaadzabbb"); //should fail
+ test_named_captures("(a)(?P<alt>b|$)", "ab");
+ test_named_captures("(a)(?P<alt>b|$)", "a");
+}
+
+void test_named_retrieval()
+{
+ smatch matches;
+ regex ad("got (?P<drink>\\w+)\\?$");
+ string text = "got milk?";
+ if (regex_match(text, matches, ad, match_extra) && matches["drink"] == "milk")
+ cout << "passed ad\n";
+ else
+ cout << "failed ad\n";
+
+ regex magic("(?P<first>abra)ca(?P<second>dabra)!");
+ text = "abracadabra!";
+ if (regex_match(text, matches, magic, match_extra) && matches["first"] == "abra" && matches["second"] == "dabra")
+ cout << "passed magic\n";
+ else
+ cout << "failed magic\n";
+
+ regex poem("(?P<first>.*), (\\w+) (?P<second>.*) D.*");
+ text = "Twas brillig, and the slithy toves Did gyre and gimble in the wabe";
+ if (regex_match(text, matches, poem, match_extra) &&
+ matches["first"] == "Twas brillig" && matches["second"] == "the slithy toves" &&
+ matches["second"] == matches[3])
+ cout << "passed poem\n";
+ else
+ cout << "failed poem\n";
+}
+
+void test_named_backrefs()
+{
+ test_named_captures("(?P<alpha>a)bc(?P=alpha)", "abca");
+ test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabcaaa");
+ test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabca"); //should fail
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abb");
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "add");
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abd"); //should fail
+ test_named_captures("(?P<name>\\w+) (.*) (?P=name)", "Jameson R. Jameson");
+ test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbbb");
+ test_named_captures("(a+(?P<inner>b+))c(?P=inner)", "aabcb");
+ test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbb"); //should fail
+ test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
+ test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
+ // the two below should (and do) cause runtime errors when the pattern compiles
+ //test_named_captures("(?P=alpha)", "abca"); //should fail
+ //test_named_captures("(?P=<alpha>.*)(?=beta)", "abab"); //should fail
+}
+
+int main(int argc, char * argv[])
+{
+ test_named_groups();
+ test_named_retrieval();
+ test_named_backrefs();
+
+ return 0;
 }
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk