#include "stdafx.h"
using namespace System;
using namespace System::Text::RegularExpressions;
int main()
{
String^ txt="42 43";
String^ re1=".*?";
String^ re2="\\d+";
String^ re3=".*?";
String^ re4="(\\d+)";
Regex^ r = gcnew Regex(re1+re2+re3+re4,RegexOptions::IgnoreCase|RegexOptions::Singleline);
Match^ m = r->Match(txt);
if (m->Success)
{
String^ int1=m->Groups[1]->Captures[0]->ToString();
Console::Write("("+int1->ToString()+")"+"\n");
}
Console::ReadLine();
}
|