简体   繁体   English

Notepad ++使用正则表达式查找和替换

[英]Notepad++ Find and replace using regex

I need to trim a single whitespace in a large txt file using regex within Notepad++'s find and replace function. 我需要在Notepad ++的查找和替换功能中使用正则表达式来修剪大型txt文件中的单个空格。

The pattern is: 模式是:

06.01.001.01.04 

Including the space after the 4. All entries follow the same pattern of 2 numbers, dot 2 numbers dot, 3 numbers dot, 2 numbers dot, 2 numbers. 包括4后面的空格。所有条目都遵循相同的模式,即2个数字,2个点,3个点,2个点,2个数字。 There is no dot before or after the numbers. 在数字之前或之后没有点。

My understanding is that I can replace the value found with the found value but with the following space removed. 我的理解是,我可以将找到的值替换为找到的值,但要删除以下空格。

Find (\\.\\d{2})\\s 查找(\\.\\d{2})\\s

Replace $1 替换$1

If you have more numbered format, make it more explicit: 如果您有更多编号的格式,请使其更明确:

Find (\\d{2}\\.\\d{2}\\.\\d{3}\\.\\d{2}\\.\\d{2})\\s 查找(\\d{2}\\.\\d{2}\\.\\d{3}\\.\\d{2}\\.\\d{2})\\s

Following may help you here. 以下内容可能会对您有所帮助。

Place in find following regex: 放在查找以下正则表达式中:

([0-9]{2}\.[0-9]{2}\.[0-9]{3}\.[0-9]{2}\.[0-9]{2})\s+

Place following in replace: 将以下内容替换:

$1\n

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM