2009年6月30日 星期二

Regular Expression in .NET

使用的範例如下:
Regex^ rx = gcnew Regex("[0-9]*[a-z]*.*");///字串的詳細寫法可參考下面網址
String^ str = "012abc";
if(rx->match(str)->Success)
{
this->textBox1->Text = str;
}
///記得"\"前面需要再加個"\",變成"\\"。
可參考網址:
(1)http://www.codeproject.com/KB/dotnet/regextutorial.aspx
(2)http://msdn.microsoft.com/en-us/library/hs600312.aspx
(3)http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx