就是去掉所有尾数123
比如:
sourcetxt="C:\program file\123\pro123123123"
targettxt="C:\program file\123\pro"
sourcetxt="abcd123123"
targettxt="abcd"
比如:
sourcetxt="C:\program file\123\pro123123123"
targettxt="C:\program file\123\pro"
sourcetxt="abcd123123"
targettxt="abcd"
String targettxt = Regex.Replace(sourcetxt,@"\d*$","");
sourcetxt=Regex.Match(sourcetxt,".*?(?=(123)+$)").Value;呵呵
Regex re=new Regex(@"123$");
While(re.Match(sourcetxt).Success)
sourcetxt= Regex.Replace(sourcetxt,@"123$","");
cancerser(都是混饭吃,记得要结帖)的 ".*?(?=(123)+$)"
(?=(123)+$)我知道代表的是123末尾的数
但".*?"的?是什么意思呢
我把这个"?"去掉,显示结果只会去掉最后1个123
感谢cancerser(都是混饭吃,记得要结帖)和mmqingfeng(漠漠青峰)
结帖