如何在另一场比赛后匹配所有事件?
例如:我想用空格替换所有-
之后abc
。
输入:
one-two-abc-three-four-five
six-seven-abc-eight-nine-ten
...
Run Code Online (Sandbox Code Playgroud)
输出:
one-two-abc three four five
six-seven-abc eight nine ten
...
Run Code Online (Sandbox Code Playgroud)
在 Javascript 中可以使用这个正则表达式:(?<=(.+abc.+))-
,但Positive Lookbehind
Notepad++ 似乎不支持
谢谢。
PS:请随意更正标题。我尽力了,但我不是母语人士。
这将适用于字符串中任意数量的连字符。
(?:^.*abc|\G[^-\r\n]+)\K-
#一个空格. matches newline
解释:
(?: # non capture group
^ # beginning of line
.* # 0 or more any character but newline
abc # literally abc
| # OR
\G # restart from last match position
[^-\r\n]+ # 1 or more any character that is not hyphen or line break
) # end group
\K # forget all we have seen until this position
- # hyphen
Run Code Online (Sandbox Code Playgroud)
截图(之前):
截图(后):
归档时间: |
|
查看次数: |
1247 次 |
最近记录: |