Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Global s1

boost::xpressive::s1 — Sub-match placeholder, like $1 in perl.

Synopsis

// In header: <boost/xpressive/regex_primitives.hpp>

mark_tag const s1;

Description

To create a sub-match, assign a sub-expression to the sub-match placeholder. For instance, (s1= _) will match any one character and remember which character was matched in the 1st sub-match. Later in the pattern, you can refer back to the sub-match. For instance, (s1= _) >> s1 will match any character, and then match the same character again.

After a successful regex_match() or regex_search(), the sub-match placeholders can be used to index into the match_results<> object to retrieve the Nth sub-match.


PrevUpHomeNext