目标:用由sup
标记包围的连续星号替换连续星号。用数字替换字符
输入
Hello, my name is Chris Happy*. My profile picture is a happy face.**
*: It's not my actual name, but a nickname.
**: Well, my "last name" is happy, so I think it's fitting.
输出
Hello, my name is Chris Happy<sup>1</sup>. My profile picture is a happy face.<sup>2</sup>
<sup>1</sup>: It's not my actual name, but a nickname.
<sup>2</sup>: Well, my "last name" is happy, so I think it's fitting.
我怎么能有效地做到这一点?
你想删除什么? –
不是“重复连续字符”而是“计数并替换_a特定字符_”?如果你想统计重复的连续字符,你会得到'快乐'中的'p'命中。 – msanford
我有点困惑,第一个匹配'my',''name'和'a',第二个匹配'my','name','is'和'happy', ?如果它只是匹配一个名字,你怎么知道一个名字是什么? – adeneo