我無法讓我的C#正則表達式在C++中工作。在C#中,我有:將C#正則表達式轉換爲C++/CLI?
//using System.Text.RegularExpressions;
Regex YourName = new Regex("?<name>\w{3,16}");
但在C++中,這並不正確匹配:
//using namespace System::Text::RegularExpressions;
Regex^ rx = gcnew Regex("?<name>\w{3,16}", static_cast<RegexOptions>(RegexOptions::Compiled));
依次爲:
MatchCollection^ matches = rx->Matches(input); //input=String^
較量總是返回0計數。我在做一些非常愚蠢的事情嗎?將C#正則表達式轉換爲C++正則表達式需要做些什麼?非常感謝您爲此付出的任何光芒。
這是C#,不是C. C沒有任何類型的正則表達式。 – 2010-06-04 20:11:39