Regex Notepad ++在每个包含3个以上字符的大写单词之前插入新行

时间:2017-07-23 09:28:19

标签: regex notepad++

任何人都可以帮助进行搜索/替换,在每个大写单词之前插入一个新行。我一直在搜索,我运行的任何查询都替换了大写的单词。任何帮助表示感谢。

我有一行文字如下:

ALEXANDER Agnes Died May 10 1841 age 80 mother of George of Grange-Foyle ALEXANDER Anne Died Aug 5 1912 wife of William Alexander ALEXANDER Elizabeth Died Nov 27 1794 age 75 wife of Joseph Alexander ALEXANDER George Farmer of Grange-Foyle

我希望这样,即每个姓氏的新行

>    ALEXANDER Agnes Died May 10 1841 age 80 mother of George of Grange-Foyle
>    ALEXANDER Anne Died Aug 5 1912 wife of William Alexander
>    ALEXANDER Elizabeth Died
>    ALEXANDER George Farmer of Grange-Foyle

任何帮助表示赞赏

2 个答案:

答案 0 :(得分:1)

您可以搜索前面带有空格的所有2个超文本字符,将它们放在组中,并用捕获组之前的换行符替换它们,例如

Find what:    (?:\s)([A-Z]{2,})
Replace with: \n\1

并确保选择了function main(){ //functions to exexute. } ,并确保搜索&替换在onsubmit="main()" 模式下工作。

答案 1 :(得分:1)

你可以去:

(?!\A)\b[A-Z]{3,}\b

并将其替换为

\n$0

请参阅a demo on regex101.com