首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

请问正则表达式(去掉尾数)

2012-01-26 
请教正则表达式(去掉尾数)就是去掉所有尾数123比如:sourcetxt C:\programfile\123\pro123123123 target

请教正则表达式(去掉尾数)
就是去掉所有尾数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;

呵呵

热点排行