메뉴 건너뛰기

app

[C++] 정규식을 사용하기 위한 clr

박영식2011.05.05 00:37조회 수 3586댓글 0

  • 1
    • 글자 크기

#using <system.dll>

using namespace System;
using namespace System::Text::RegularExpressions;

int _tmain(int argc, _TCHAR* argv[])
{
//FindnFile("D:riss4uWebContent");
int words = 0;
   String^ pattern = "[a-zA-Z]*";
   Console::WriteLine( "pattern : '{0}'", pattern );
   Regex^ regex = gcnew Regex( pattern );

   String^ line = "onettwo three:four,five six  seven";   
   Console::WriteLine( "text : '{0}'", line );
   for( Match^ match = regex->Match( line ); 
        match->Success; match = match->NextMatch( ) ) 
   {
      if( match->Value->Length > 0 )
      {
         words++;
         Console::WriteLine( "{0}", match->Value );
      }
   }
   Console::WriteLine( "Number of Words : {0}", words );

   return 0;
}


공통언어런타임 지원을 설정해야 한다.(프로젝트 -> 속성 에서 설정)

clr.jpg


박영식 (비회원)
  • 1
    • 글자 크기
[Gdata] PHP를 이용해 Spread sheet 접근 (by 박영식) [C++] 하위 폴더 검색 최간편 소스 (by 박영식)

댓글 달기

suritam9
2013.06.28 조회 2680
suritam9
2013.04.25 조회 6495
suritam9
2013.04.04 조회 2466
suritam9
2012.09.14 조회 2740
suritam9
2012.06.24 조회 2641
suritam9
2012.06.24 조회 3045
suritam9
2012.06.24 조회 2828
suritam9
2012.06.22 조회 2831
박영식
2011.09.22 조회 2863
박영식
2011.09.21 조회 2795
박영식
2011.02.18 조회 3271
첨부 (1)
clr.jpg
77.3KB / Download 73
위로