You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Sublime Text 4中将每3行UUID文本合并为单行?

Solution for Merging Every 3 Lines in Sublime Text 4

To merge each set of 3 UUID lines into a single line in Sublime Text 4, use this regex-based find-and-replace workflow:

Step-by-Step Instructions

  1. Open your UUID file in Sublime Text.
  2. Press Ctrl+H (Windows/Linux) or Cmd+H (Mac) to open the Find/Replace panel.
  3. Enable Regular Expression mode by clicking the .* button in the panel.
  4. Enter these patterns:
    • Find What: ('.*',)(?:\R|$)('.*',)(?:\R|$)('.*',)(?:\R|$)
    • Replace With: $1 $2 $3\n
  5. Click Replace All to apply changes to the entire file.

Explanation

  • The Find What pattern captures three complete UUID lines (each ending with a comma and either a line break or end of file) into separate groups ($1, $2, $3). This fixes your original regex issue, which captured all three lines as a single group instead of individual entries.
  • The Replace With string combines the three groups into one line, separated by spaces, and adds a trailing newline to match your desired output structure.
  • \R matches any line ending (LF, CRLF, CR), ensuring compatibility across different operating systems.

Handling Non-Multiples of 3

If your file has leftover lines (1 or 2 lines not part of a triplet), they’ll remain unchanged. To merge these too:

  • For pairs: Use ('.*',)(?:\R|$)('.*',)(?:\R|$) and replace with $1 $2\n
  • Single lines: No action needed—they’re already in the correct format.

Content of the question originates from Stack Exchange, asked by Bitswazsky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 00:25:26