Regular expression: Difference between revisions

Jump to navigation Jump to search
679 bytes removed ,  10 August 2015
Line 254: Line 254:


參考資料: [http://stackoverflow.com/questions/8413237/notepad-regex-search-replace-how-to-append-and-prepend-a-character-at-start-a Notepad++ RegEx Search/Replace: How to append and prepend a character at start and end of each file line? - Stack Overflow]
參考資料: [http://stackoverflow.com/questions/8413237/notepad-regex-search-replace-how-to-append-and-prepend-a-character-at-start-a Notepad++ RegEx Search/Replace: How to append and prepend a character at start and end of each file line? - Stack Overflow]
=== 將行內一個或多個空白,取代成 Tab鍵 ===
將原本空白間隔的欄位值,取代成 Tab鍵間隔的欄位值。輸出結果可以方便貼到 MS Excel 或 [[Google spreadsheet]]。
<pre>
欄位1 多個空白 欄位2 多個空白 欄位3
->
欄位1 Tab鍵 欄位2 Tab鍵 欄位3  (本行文字為方便說明,用空白間隔,實際上是沒有空白的)
</pre>
說明: \S 代表非空白字元, \r\n 代表換行符號。[^\S\r\n] 則代表不是非空白字元、也不是換行符號。換句話說尋找空白,但不包含換行符號。
# Find: {{code | code = <nowiki>([^\S\r\n]+)</nowiki>}}
# Replace with: {{code | code = <nowiki>\t</nowiki>}}


=== 知道前面跟後面的文字,但是中間文字忘記了 ===
=== 知道前面跟後面的文字,但是中間文字忘記了 ===

Navigation menu