如何仅更改 <LNK:XXX> 与 localhost,而将块的其余部分保持原样?

How do I change only the <LNK:XXX> with localhost, leaving the rest of the block as is?

我想将下面的 LNK:XXX 更改为 'localhost',其他一切保持原样。 来自:

$FLD  tcp:<LNK:FLD>+<PORT>|<ACCOUNT>|<PASSWORD>|fsvr
$SVC  tcp:<LNK:SVC>+<PORT>|<ACCOUNT>|<PASSWORD>|rsvr
$SRV  tcp:<LNK:SRV>+<PORT>|<ACCOUNT>|<PASSWORD>|ysvr
$DOC  tcp:<LNK:DOC>+<PORT>|<ACCOUNT>|<PASSWORD>|dsvr
$XSL  tcp:<LNK:XSL>+<PORT>|<ACCOUNT>|<PASSWORD>|xsvr
$XSD  tcp:<LNK:XSD>+<PORT>|<ACCOUNT>|<PASSWORD>|xsvr
$PDF  tcp:<LNK:PDF>+<PORT>|<ACCOUNT>|<PASSWORD>|asvr
$EML  tcp:<LNK:EML>+<PORT>|<ACCOUNT>|<PASSWORD>|esvr
$BBD  tcp:<LNK:BBD>+<PORT>|<ACCOUNT>|<PASSWORD>|bsvr
$DEW  tcp:<LNK:DEW>+<PORT>|<ACCOUNT>|<PASSWORD>|dwsvr
$JAR  tcp:<LNK:JAR>+<PORT>|<ACCOUNT>|<PASSWORD>|jsvr
$DUT  tcp:<LNK:DUT>+<PORT>|<ACCOUNT>|<PASSWORD>|hsvr
$SUP  tcp:<LNK:SUP>+<PORT>|<ACCOUNT>|<PASSWORD>|susvr

为此:

$FLD  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|fsvr
$SVC  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|rsvr
$SRV  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|ysvr
$DOC  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|dsvr
$XSL  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|xsvr
$XSD  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|xsvr
$PDF  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|asvr
$EML  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|esvr
$BBD  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|bsvr
$DEW  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|dwsvr
$JAR  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|jsvr
$DUT  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|hsvr
$SUP  tcp:localhost+<PORT>|<ACCOUNT>|<PASSWORD>|susvr

我试过 LNK:.* 但它匹配整行。

你需要

查找内容<LNK:[^>]*>
替换为localhost

regex demo详情:

  • <LNK: - 文字 <LNK: 字符串
  • [^>]* - >
  • 以外的零个或多个字符
  • > - 文字 > 字符。