//用RegularExpress取代或移除Html標籤

宣告using System.Text.RegularExpressions;


// 把myOriginalStr裡面的相關font元素都移除掉
Regex myRegex  = new Regex("<font(.)*?>|</font>");
string myNoFontStr = myRegex.Replace(myOriginalStr, "");


// 判斷是否是數字
裡面的Regular Express判斷式也可用在JavaScript
Regex myRegex = new Regex(@"^\s*[-\+]?\d+\s*$");

if(myRegex.IsMatch(myOriginalStr))
{
// 如果是正負號的整數的話
}

arrow
arrow
    全站熱搜

    welkingunther 發表在 痞客邦 留言(0) 人氣()