| Home | Libraries | People | FAQ | More

## Function template as_xpr

boost::xpressive::as_xpr — Makes a literal into a regular expression.

## Synopsis

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

    template<typename Literal> unspecified as_xpr(Literal const & literal);

## Description

Use as_xpr() to turn a literal into a regular expression. For instance, "foo" >> "bar" will not compile because both operands to the right-shift operator are const char*, and no such operator exists. Use as_xpr("foo") >> "bar" instead.

You can use as_xpr() with character literals in addition to string literals. For instance, as_xpr('a') will match an 'a'. You can also complement a character literal, as with ~as_xpr('a'). This will match any one character that is not an 'a'.