新线的定期到期? [英] Regular expiration for new line?
本文介绍了新线的定期到期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望正则表达式在第5个空格后换成新行吗?
它会一直持续到文件结尾...
I Want regex for after 5th white space replace into new line?
it will be continue up to end of file...
推荐答案
在正则表达式中,新行也是一个空格,所以你可能意味着空间(或者也可能是制表符)...
In regular expression new line is also a whitespace, so you probably meant space (or maybe tab too)...
string szOriginal = "whatever you have";
string szPattern = "[ \t]{5,}" // space or tab, 5 or more in a row...
Regex oRegex = new Regex(szPattern);
string szResult = oRegex.Replace(szOriginal , Environment.NewLine);
这篇关于新线的定期到期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文