Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你好!
如果之前有人问过这个问题,我深表歉意,但我花了一些时间搜索以前的帖子,但我无法找到这个我似乎无法弄清楚的简单问题的答案。
使用带有替换功能的 Notepad++ 和正则表达式,我试图将示例字符串转换成这样:
原文
州:明尼苏达州:数据
期望的输出
州:明尼苏达
我以为我已经找到了答案,只需在 Find 中使用:.*并将 Replace 留空,但无论出于何种原因,正则表达式对我来说一直是一个难题。
先感谢您 !
使用以下正则表达式:
^(.*?:.*?):.*
或者,
^([^:\r\n]*:[^:\r\n]*):.*
并替换为$1.
$1
细节
^
(.*?:.*?)
[^:\r\n]
:
.*
截屏: