求截取价格正则表达式
求取出价格正则表达式,如下 给方法传个字符串 就可以准确返回价格
static void Main(string[] args)
{
getPriceByRegularExpression("¥11"); --取出11
getPriceByRegularExpression("¥11.11"); --取出11.11
getPriceByRegularExpression("11.11"); --取出11.11
getPriceByRegularExpression("我11.11"); --取出11.11
getPriceByRegularExpression(" 11.11"); --取出11.11
getPriceByRegularExpression(".11.11."); --取出11.11
getPriceByRegularExpression("我0你"); --取出0
getPriceByRegularExpression("0.0"); --取出0
}
//正则取出价格
public static string getPriceByRegularExpression(string priceInfo)
{
string pattern = ??????;
string price = Regex.Match(priceInfo, pattern, RegexOptions.Singleline).ToString();
return price;
}
" method="showImagePop" alt="求截取明码正则表达式" SourceType="2" imageId="640e825f-e445-47fe-9a56-dd5418643dbe" src="http://www.elongstatic.com/imageapp/hotels/hotelimages/0101/40101230/1_901d094f-a5d5-4853-aa2a-7a6dc056baa0.jpg?v=20121031160142" onerror="this.src='http://www.elongstatic.com/hotels/pic/detailnoimg.png'" width="310" height="220" />