使用正则表达式查找和替换 Google Sheet 的输入

Find & replace using regex for input to Google Sheet

我有一个数据集:

1.  
Name1  
Name2  
Name3  
2.  
Name1  
Name2.  
Name3  

等等。

使用正则表达式,我希望输出为:

Name1,Name2,Name3  
Name1,Name2.,Name3  

我正在尝试导入 google sheet,因此需要一个逗号分隔的文件。我认为这些步骤是用 \n 替换数字后跟一个句点,然后在每个列名后添加一个逗号。请注意,某些字段例如:Name2. 有一个数字后跟一个句点,因此 \d+[.]

有问题
  • Ctrl+H
  • 查找内容:^(.+)\R(.+)\R(.+)$
  • 替换为:,,
  • 检查 环绕
  • 检查 正则表达式
  • 取消选中 . matches newline
  • 全部替换

解释:

^                   # beginning of line
    (.+)            # group 1, 1 or more any character but newline
    \R              # any kind of  linebreak
    (.+)            # group 2, 1 or more any character but newline
    \R              # any kind of  linebreak
    (.+)            # group 3, 1 or more any character but newline
$

替换:

          # content of group 1
,           # comma
          # content of group 2
,           # comma
          # content of group 3

屏幕截图(之前):

截图(后):