Question

I'm doing a CTRL+H (Find & Replace) in Notepad++

I want to find all Line breaks followed by lowercase characters in order to replace them with a space character ; thereby removing unwanted break lines in my text.

Find : \r\n+(?![A-Z]|[0-9])

Replace : insert space character here

*Make sure you selected "Match case" and "Regular expression".

It works perfect.

Now, I'd like to do the same in Microsoft Office Word documents. Any clues?

Was it helpful?

Solution

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! :)

OTHER TIPS

in vscode tap on find press the keys ctrl/enter for second line then type (?=[a-z]) and in the replace add a space

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top