Notepad ++ / 提取 ^ ^ 之间的文本并将其添加为新行

Notepad ++ / 提取 ^ ^ 之间的文本并将其添加为新行

我有一个文本文件,需要从中提取特定的数据元素(将人员全名添加为新行):

ID:363712^CLARK/DEJA G^:e30276c2f826febd3784958:KZxhnbUUouxvMrTEYfGnDZ7YcGjPh

ID:363713^LUTZ/ANTON A^:84cF6F48eAc2b5E223Bf1703:ZD4LLGMqNyNYYtjLycdEds23A2

ID:363714^OATO/GINA D^:GnDZ7YcGjPh6Ru7cEjfQGZgD:GMqNyNYYtjLycdEdcxRijNc7G


我想要提取:

DEJA G CLARK
ID:363712^CLARK/DEJA G^:e30276c2f826febd3784958:KZxhnbUUouxvMrTEYfGnDZ7YcGjPh

安东·A·卢茨
ID:363713^LUTZ/安东·A^:84cF6F48eAc2b5E223Bf1703:ZD4LLGMqNyNYYtjLycdEds23A2

GINA OATO
ID:363714^OATO/GINA^:GnDZ7YcGjPh6Ru7cEjfQGZgD:GMqNyNYYtjLycdEdcxRijNc7G



问候

答案1

  1. 按 Ctrl+H
  2. 找什么:(.+\^)(.+)(\/)(.+)(\^.+)
  3. 用。。。来代替:$4 $2\n$1$2$3$4$5
  4. 搜索模式:正则表达式
  5. 按“全部替换”

图片:

图片:

答案2

  • Ctrl+H
  • 找什么:^.+?\^(.+?)/(.+?)\^.+$
  • 用。。。来代替:$2 $1\n$0
  • 查看 环绕
  • 查看 正则表达式
  • 取消选中 . matches newline
  • Replace all

解释:

^           # beginning of line
    .+?         # 1 or more any character but newline, not greedy
    \^          # carret, have to be escaped as it's a special character for regex
    (.+?)       # group 1, 1 or more any character but newline, not greedy
    /           # a slash
    (.+?)       # group 2, 1 or more any character but newline, not greedy
    \^          # carret, have to be escaped as it's a special character for regex
    .+          # 1 or more any character but newline
$           # end of line

替代品:

$2          # content of group 2 (firstname initial) followed by a space
$1          # content of group 1 (lastname)
\n          # linefeed, you may use \r\n for Windows EOL
$0          # the whole match (i.e. the whole line)

截图(之前):

在此处输入图片描述

截图(之后):

在此处输入图片描述

相关内容