我需要一个执行以下操作的正则表达式
- 如果起始行中第一个单词的第一个字母在 小写。
- 从包含上述字母表的单词开始,替换为空 字符串直到出现以大写字母开头的单词
这是我尝试过的:
string result = Regex.Replace(input,@"^[a-z]\s?[a-z0-9]\s?[^A-Z]","");
这是应该发生的事情:
Sample input = "of !jgf area. The wealth of nation"
Required Output ="The Wealth of nation"
我应该怎么做才能改进/纠正?
最佳答案
你可以像下面那样做:
string result = Regex.Replace(input,@"^[^A-Z]*","");
关于c# - 用空字符串替换的正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12854686/