使用 notepad++ 和 RegEx 尋找數字並移至行尾

使用 notepad++ 和 RegEx 尋找數字並移至行尾

我需要將數字字元從下面的範例中的行乞討移動到行尾。我打算使用RegExNotepad++。為了找到數字,我使用[1-9]+表達式。但是如何選擇這個數字並移動到行尾呢?

目前的:

 1 #define AAA
 2 #define BBB
 123 #define CCC

應該:

 #define AAA 1
 #define BBB 2
 #define CCC 123

答案1

我用的是N++ v7.2.2

Ctrl+H --> 取代選項卡
找出內容:(^)(\s+)?(\d+)(\s+)(#define)(\s+)([^\r\n]+)?(\r \ n|$)
替換為:\1\5\6\7\4\3\8
環繞:選取
搜尋模式:正規表示式

相關內容