在记事本++中使用正则表达式时卡住了
Got stuck while using regular expression in notepad++
我试过用notepad++在4个字符后用逗号分隔字符。
但输出与预期不符。
输出得到:11,1111,1011,0011,1110,1111,1111,1111,11
预期输出:1111,1110,1100,1111,1011,1111,1111,1111
我附上了一张图片。
enter image description here
- Ctrl+H
- 查找内容:
(?:^|\G)....\K
- 替换为:
,
- 检查 环绕
- 检查 正则表达式
- 取消选中
. matches newline
- 全部替换
解释:
(?:^|\G) # non capture group, beginning of lien OR restart from last match position
.... # 4 any character but newline
\K # forget all we have seen until this position
截图(之前):
截图(之后):
我试过用notepad++在4个字符后用逗号分隔字符。 但输出与预期不符。
输出得到:11,1111,1011,0011,1110,1111,1111,1111,11
预期输出:1111,1110,1100,1111,1011,1111,1111,1111
我附上了一张图片。
enter image description here
- Ctrl+H
- 查找内容:
(?:^|\G)....\K
- 替换为:
,
- 检查 环绕
- 检查 正则表达式
- 取消选中
. matches newline
- 全部替换
解释:
(?:^|\G) # non capture group, beginning of lien OR restart from last match position
.... # 4 any character but newline
\K # forget all we have seen until this position
截图(之前):
截图(之后):