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