I've been using Xpressive and think it's great. But, I think the following program shows two problems.

Problem 1:   You get a runtime error if you uncomment the line "std::wcout << what2.position(0) << L'\n';"
Problem 2:   I think it should output:
This is my face
is
my
face

But it actually outputs:
This is
is

Note that if you replace the nested regular expression with the (commented out) non-nested one, it still outputs the wrong thing.  It outputs "This is" instead of "This is my face."
Here is the program.  Thanks for your help.

 

#include <iostream>

#include <boost/xpressive/xpressive.hpp>

using namespace boost::xpressive;

 

int main()

{

    std::wstring str( L"This is his face." );

 

    // find a whole word

    wsregex subtokens = +alnum;

    wsregex token = as_xpr(L"This ") >> subtokens;

//  wsregex token = as_xpr(L"This ") >> +alnum; // Also outputs the wrong thing

 

    wsregex_iterator cur( str.begin(), str.end(), token );

    wsregex_iterator end;

    for( ; cur != end; ++cur )

    {

        wsmatch const &what = *cur;

        std::wcout << what.str(0) << L'\n';

 

        wsmatch::nested_results_type::const_iterator cur2 = what.nested_results().begin();

        wsmatch::nested_results_type::const_iterator end2 = what.nested_results().end();

        for ( ; cur2 != end2; ++cur2) {

            wsmatch const &what2 = *cur2;

            std::wcout << what2.str(0) << L'\n';

//          std::wcout << what2.position(0) << L'\n'; // CAUSES RUNTIME ERROR

        }

    }

    std::cout << "\n\n" << std::flush;

    return 0;

}