Regexp break long lines [duplicate]
问题 This question already has answers here : How to write RegEx for inserting line break for line length more than 30 characters? (2 answers) Closed 5 days ago . 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