轻松掌握 C++ 正则表达式
VerbalExpressions is a C++11 Header library that helps to construct difficult regular expressions.
This C++ lib is based off of the (original) Javascript VerbalExpressions library by jehna.
You can see an up to date list of all ports on VerbalExpressions.github.io.
In case you do not have C++11 compliant standard library you can still use boost.regex.
Here's a couple of simple examples to give an idea of how VerbalExpressions works:
// Create an example of how to test for correctly formed URLs
verex expr = verex()
.search_one_line()
.start_of_line()
.then( "http" )
.maybe( "s" )
.then( "://" )
.maybe( "www." )
.anything_but( " " )
.end_of_line();
// Use verex's test() function to find if it matches
std::cout > & args )
* .range( const std::std::string & a, const & std::string b )
* .tab()
* .word()
### Modifiers
* .with_any_case()
* .search_one_line()
* .search_global()
### Functions
* .replace( const std::string & source, const std::string & value )
* .test()
### Other
* .add( expression )
* .multiple( const std::string & value )
* .alt()暂无开放 Issues,或尚未同步最近议题。