如何用Notepad++移除换行并每150字符后新增换行?
Notepad++ Guide: Merge Lines & Split into 150-Character Chunks
Here's a straightforward, step-by-step walkthrough to get your text formatted exactly how you need it:
Step 1: Remove All Line Breaks (Merge into a Single Line)
- Open your 20-line file in Notepad++.
- Hit
Ctrl+Hto bring up the Replace tool. - In the "Find what" box, type
\r\n(this targets Windows-style line endings; if that doesn’t work, try\nfor Unix-style). - Leave the "Replace with" box completely empty (no spaces, nothing).
- Under "Search Mode", select Extended (this enables Notepad++ to recognize the line break escape codes).
- Click Replace All – all your lines will merge into one continuous 1000-digit string.
Step 2: Split Every 150 Characters with a New Line
- Keep the merged text open, and re-open the Replace tool (
Ctrl+H). - Switch "Search Mode" to Regular expression.
- In "Find what", enter
(.{150})– this regex captures every block of 150 consecutive characters. - In "Replace with", enter
$1\r\n–$1inserts the captured 150-character chunk, and\r\nadds a line break right after it. - Click Replace All – your text will now split into lines of 150 characters (with the final line being 100 characters, since 1000 isn’t a perfect multiple of 150).
Quick check: After step 2, you should have 7 lines total (6 lines of 150, 1 line of 100).
内容的提问来源于stack exchange,提问作者inin
相关产品推荐
相关产品推荐

