假设我有以下代码:
string input = "hello everyone, hullo anything";
string pattern = "h.llo [A-z]+";
string output = Regex.Replace(input,pattern,"world");
Run Code Online (Sandbox Code Playgroud)
(我已经尽力让它尽可能简单)
上面的代码输出是,"world, world"而我真正想要的是一种更改h.lloto之后的所有单词的方法world,并且我希望输出为"hello world, hullo world"
我一直在寻找一种方法来做到这一点,我进行了很多搜索并阅读了这篇文章:
但我并没有从中得到太多,而且我不确定这是否正是我想要的。
有什么办法吗?