RegEx : Remove line breaks if lookbehind shows a lowercase

安稳与你 提交于 2019-12-04 16:26:17

In Microsoft Word, do the following:

  1. On the Home tab, in the Editing group, click Replace to open the Find and Replace dialog box.

  2. Check the Use wildcards check box. If you don't see the Use wildcards check box, click More, and then select the check box.

  3. In the Find what: box, enter the following regular expression: ([a-z])^13

  4. In the Replace with: box, enter: \1 - thats: (backslash 1 SPACE) (don't forget the space!)

And that's it! Then click either the Replace button or the Replace All button.

Note: In MS Word, the ^13 character matches the paragraph mark at the end of each line.

Here's more information about Microsoft Word and Regular Expressions - http://office.microsoft.com/en-us/word-help/find-and-replace-text-by-using-regular-expressions-advanced-HA102350661.aspx

Edit:

Oh, the above matches lowercase letter PRECEDING line break.

If you want to match line break FOLLOWED by lowercase letter, do the following:

  1. In the Find what: box, enter the following regular expression: ^13([a-z])

  2. In the Replace with: box, enter: \1 - thats: (SPACE backslash 1) (don't forget the space!)

Tested both ways and they both work in Microsoft Word 2010, however documentation says that regular expressions are supported in all versions 97 - 2013.

Good luck! :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!