首页 > 其他 > 详细

TRegEx 正则表达式

时间:2015-07-14 17:15:04      阅读:170      评论:0      收藏:0      [点我收藏+]

TRegEx 
#include <System.RegularExpressions.hpp>

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  const String bigString = "Look for a the strings in this strang of strungs.";
  const String littlestring = "(str)([iau]ng)";
  TRegEx *regex;
  TGroupCollection mygrps;
 
  regex = new TRegEx(littlestring);
  mycoll = regex->Matches(bigString);
  Edit1->Text = "Count: " + IntToStr(mycoll.Count);
  Memo1->Lines->Add("First Collection: ");
  for (int i=0; i < mycoll.Count; i++)
  {
    Memo1->Lines->Add("Match #" + IntToStr(i) + ": " + mycoll.Item[i].Value);
    Memo1->Lines->Add("Group: " + IntToStr(i));
    mygrps = mycoll.Item[i].Groups;
    for (int j=0; j < mygrps.Count; j++)
      Memo1->Lines->Add("Value: " + mygrps.Item[j].Value);
  };
}

 

TRegEx 正则表达式

原文:http://www.cnblogs.com/cb168/p/4645474.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!