问题
I want to break long lines for 5 characters and doesn`t touch short lines:
aaa
bbbbbbb
cc
dddddddddddd
into
aaa
bbbbb
bb
cc
ddddd
ddddd
dd
I`ve found way to find only long lines:
^(.{5,})
, but I've no idea how to break it to fives several times.
Another way is: find .{0,5}(\s*|$)
replace $0\n
- it works but after each previous line it creates new empty line. Even after short lines.
I`m testing in Sublime Text 3. So maybe some Sublime plugin could do it as well.
回答1:
A line break can be inserted like this :
Find ([^\r\n]{5})
replace $1\r\n
https://regex101.com/r/dTeMbq/1
来源:https://stackoverflow.com/questions/59413771/regexp-break-long-lines