当前位置: 技术问答>linux和unix
请问:visual c/c++有vbscript/jscript/vb下类似功能的正则表达式类或函数吗?
来源: 互联网 发布时间:2015-07-21
本文导语: jscript/vbscript中都有正则表达式对象可供食用,对于字符串匹配非常有用。不知道vc下有没有此相应类或函数。请好心人提供线索或简要步骤。 | 具体下载URL:http://research.microsoft.com/projects/greta/...
jscript/vbscript中都有正则表达式对象可供食用,对于字符串匹配非常有用。不知道vc下有没有此相应类或函数。请好心人提供线索或简要步骤。
|
具体下载URL:http://research.microsoft.com/projects/greta/
以下代码摘自http://www.vccode.com/file_show.php?id=2561
#include
#include
#include “regexpr2.h”
using namespace std;
using namespace regex;
int main() {
match_results results;
string str( “The book cost $12.34” );
rpattern pat( “$(d+)(.(dd))?” );
// Match a dollar sign followed by one or more digits,
// optionally followed by a period and two more digits.
// The double-escapes are necessary to satisfy the compiler.
match_results::backref_type br = pat.match( str, results );
if( br.matched ) {
cout
以下代码摘自http://www.vccode.com/file_show.php?id=2561
#include
#include
#include “regexpr2.h”
using namespace std;
using namespace regex;
int main() {
match_results results;
string str( “The book cost $12.34” );
rpattern pat( “$(d+)(.(dd))?” );
// Match a dollar sign followed by one or more digits,
// optionally followed by a period and two more digits.
// The double-escapes are necessary to satisfy the compiler.
match_results::backref_type br = pat.match( str, results );
if( br.matched ) {
cout