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);
  };
}

 sql server 字符串 正则表达式

 and dm  like '[0-9]%'

 and dm like '[A-z]%'

posted on 2015-07-14 15:01  lypzxy  阅读(497)  评论(0编辑  收藏  举报