$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Rupert Bruce (rupert_at_[hidden])
Date: 2008-06-12 15:34:21
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Per Franck wrote:
> Hello All.
>  
> I'm using the C++ library of boost RegEx. Long story short: I'm trying
> the expression 
>  
>     (?<=<h1>).*?(?=</h1>)
>  
> On the string <h1>hello there</h1>
>  
> and the engine crashes (asserts in Kernel32(d).dll)
>  
> Is this a known issue?
>  
> here's my code snippet.
>  
>  std::vector<std::string> v;
>  boost::RegEx expr( "<h1>hello there</h1>", TRUE);
>  expr.Grep(v, "(?<=<h1>).*?(?=</h1>)" );
>  
> thanks for any help!
>  
> - Per
>  
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/boost-users
I'm a little confused by your capitalization - I have the following test
cases (modified to resemble your example):
TEST(test_boost_regex1)
    {
    std::string string_to_search="<html><body><h1>hello
there</h1></body></html>";
    boost::smatch matched;
    boost::regex expression("<[hH]1>.*</[hH]1>", true);
    if (boost::regex_search(string_to_search, matched, expression))
        {
        std::cout << "Matched:" << matched << endl;
        }
    else
        {
        std::cout << "no match found" << endl;
        }
    }
TEST(test_boost_regex2)
    {
    bool match_found=false;
    std::vector<std::string> v;
    v.push_back("<h1>hello there</h1>");
    v.push_back("Hello world!");
    v.push_back("<H1>Hi</H1>");
    v.push_back("<h1>bye</h1>");
    boost::regex expression("<[hH]1>.*</[hH]1>", true);
    for (std::vector<std::string>::iterator it=v.begin(); it!=v.end(); ++it)
        {
        std::string string_to_search = *it;
        if (boost::regex_match(string_to_search, expression))
            {
            std::cout << "This string matches:" << string_to_search << endl;
            match_found=true;
            }
        }
    if (!match_found)
        {
        std::cout << "no match found" << endl;
        }
    }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkhRej0ACgkQ/X5Z5iyVCbGP9wCePPTPNi2GU0DnPYzy0SZYaO/w
tyAAniWu7Gg7EySx1P54k0bfMqt+RNz5
=n5hO
-----END PGP SIGNATURE-----