【发布时间】:2015-06-22 06:01:09
【问题描述】:
我正在使用一个文本编辑器,它允许我使用正则表达式来查找/替换文本。我有一个大文本文件,想在超过 30 个字符的行中插入新行。我希望在第 30 个字符之后换行,无论单词或短语是否中断。
原文:
Hi this is a sample text.
this is a line.
This is a very very very very very long line.
This is a regular line.
....
修改后的文字:
Hi this is a sample text.
this is a line.
This is one very very very ver
y very long line.
This is a regular line.
....
如何将正则表达式写入:
- 查找超过 30 个字符的行。
- 在长度超过 30 个字符的行的第 30 个字符后插入新行。
【问题讨论】:
-
哪种编程语言?
标签: regex