#include "stdafx.h"
using namespace System;
using namespace System::Text::RegularExpressions;
int main()
{
String^ txt="11:Jul:2018 \"This is an Example!\"";
String^ re1="(11)";
String^ re2=".*?";
String^ re3=" ";
String^ re4=".*?";
String^ re5=" ";
String^ re6=".*?";
String^ re7="( )";
Regex^ r = gcnew Regex(re1+re2+re3+re4+re5+re6+re7,RegexOptions::IgnoreCase|RegexOptions::Singleline);
Match^ m = r->Match(txt);
if (m->Success)
{
String^ int1=m->Groups[1]->Captures[0]->ToString();
String^ c1=m->Groups[2]->Captures[0]->ToString();
Console::Write("("+int1->ToString()+")"+"("+c1->ToString()+")"+"\n");
}
Console::ReadLine();
}
|