Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex using Notepad++ to add space before a capital letter

I have looked around and found good answers but none work with notepad++, most are for java and php. I have found the search strings below but obviously I'm a noob with regex as i don't know what open/close tags are proper in notepad++.

I would like to add a space before each capital letter.

Example:

StackOverflowKegger

becomes

Stack Overflow Kegger

This is what i have found.

Find: [a-z]+[A-Z]+ Replace: $1 (there is a space before the $)

Find:

(?<!^)((?<![:upper:])[:upper:]|[:upper:](?![:upper:]))

("(\\p{Ll})(\\p{Lu})","$1 $2")

(?!^)(?=[A-Z])

Any help would be appreciated.

like image 768
MojoMan Avatar asked Feb 15 '12 16:02

MojoMan


People also ask

How do you put spaces between words in notepad?

4. Press the "Enter" or "Return" key on your computer keyboard to insert a space between the lines or blocks of text. You can insert as many paragraph spaces as you want by pressing the key more than once.

How do you write spaces in regex?

\s stands for “whitespace character”. Again, which characters this actually includes, depends on the regex flavor. In all flavors discussed in this tutorial, it includes [ \t\r\n\f]. That is: \s matches a space, a tab, a carriage return, a line feed, or a form feed.

Can I use regex in Notepad?

Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.

How do you add a space in a pattern?

How do you add a space in a pattern? Simply add the space to the regex. If you wanted any whitespace, not just space, swap the space with \s .


1 Answers

Search string: (.)([A-Z])
Replacement: \1 \2

This doesn't insert spaces before capitals that are the first letter on their line.

like image 177
Cameron Avatar answered Oct 02 '22 20:10

Cameron