日期:2014-05-18  浏览次数:20863 次

请教正则表达式(去掉尾数)
就是去掉所有尾数123
比如:
sourcetxt= "C:\program   file\123\pro123123123 "
targettxt= "C:\program   file\123\pro "
sourcetxt= "abcd123123 "
targettxt= "abcd "


------解决方案--------------------
用 "\d*$ "替换
------解决方案--------------------
string sourcetxt=@ "C:\program file\123\pro123123123 ";
sourcetxt=Regex.Match(sourcetxt, ".*?(?=(123)+$) ").Value;

呵呵