Regex 在记事本和x2B之间替换正则表达式+;

Regex 在记事本和x2B之间替换正则表达式+;,regex,notepad++,Regex,Notepad++,我在csv中有一个值列表,我试图使用正则表达式搜索稍微修改它,并使用Notepad++替换它。我所拥有的包括以下示例: Text,UK_BT.BT1.BT1 1,123 Text,UK_BT.BT11.BT11 1,123 Text,IE_text.text.text,123 我想做的是删除第一个逗号和最后一个句点之间的文本,仅行中包含UK_BT。因此输出为: Text,BT1 1,123 Text,BT11 1,123 Text,IE_text.text.text,123 有人有什么线索吗

我在csv中有一个值列表,我试图使用正则表达式搜索稍微修改它,并使用Notepad++替换它。我所拥有的包括以下示例:

Text,UK_BT.BT1.BT1 1,123
Text,UK_BT.BT11.BT11 1,123
Text,IE_text.text.text,123
我想做的是删除第一个逗号和最后一个句点之间的文本,行中包含UK_BT。因此输出为:

Text,BT1 1,123
Text,BT11 1,123
Text,IE_text.text.text,123
有人有什么线索吗?Regex真的不是我的强项,通常在使用后会被遗忘! 谢谢,

查找内容:
^(?=.*UK_BT.*)([^,]+,).\.([^\.]+)$

替换为
\1\2

解释

^             # Beginning of the line.
(?=.*UK_BT.*) # Must contain 'UK_BT' (positive look ahead, not capturing group, not character consuming).
(             # Beginning of the first group.
  [^,]+,      # Everything but ',' at least one time (+) followed by ',' (first ',').
)             # End of the first group.
.*            # Everything zero or more times.
\.            # A single '.'.
(             # Beginning of the second group.
 [^\.]+       # Everything but '.' at least one time (this in combination with '\.' allows to find the last '.').
)             # End of the second group.
$             # End of the line
\1\2
允许指向第一个和第二个捕获的组。

查找内容:
^(?=.*UK_BT.*)([^,]+,).\.([^\.]+)$

替换为
\1\2

解释

^             # Beginning of the line.
(?=.*UK_BT.*) # Must contain 'UK_BT' (positive look ahead, not capturing group, not character consuming).
(             # Beginning of the first group.
  [^,]+,      # Everything but ',' at least one time (+) followed by ',' (first ',').
)             # End of the first group.
.*            # Everything zero or more times.
\.            # A single '.'.
(             # Beginning of the second group.
 [^\.]+       # Everything but '.' at least one time (this in combination with '\.' allows to find the last '.').
)             # End of the second group.
$             # End of the line

\1\2
允许指向第一个和第二个捕获的组。

下次尝试时,您不会忘记它…
查找内容:
UK.+\d\.


替换为:
nothing

下次尝试您不会忘记它的…
查找内容:
UK.+\d\.


替换为:
nothing

为什么
Text,IE_Text.Text,123
变成
Text,IE_Text.Text,123
?打字错误,已修复:)为什么
Text,IE_Text.Text,123
变成
Text,IE_Text.Text,123
?打字错误,已修复:)