Skip to content

Instantly share code, notes, and snippets.

@minamiyama1994
Last active December 20, 2015 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minamiyama1994/6171027 to your computer and use it in GitHub Desktop.
Save minamiyama1994/6171027 to your computer and use it in GitHub Desktop.
boost::xpressive's bug?
#include"boost/xpresaive/xpresaive.hpp"
namespace bx = boost::xpressive ;
auto main ( ) -> int
{
bx::sregex regex1 = bx::bos >> ( "instance" | + ( bx::range ( 'a' , 'z' ) | bx::range ( 'A' , 'Z' ) ) ) ;
bx::smatch result ;
if ( bx::regex_search ( std::string { "instanceof" } , result , regex1 ) )
{
std::cout << result.str ( ) << std::endl ; // output : "instance"
}
bx::sregex regex2 = bx::bos >> ( + ( bx::range ( 'a' , 'z' ) | bx::range ( 'A' , 'Z' ) ) | "instance" ) ;
if ( bx::regex_search ( std::string { "instanceof" } , result , regex2 ) )
{
std::cout << result.str ( ) << std::endl ; // output : "instanceof"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment