Reputation: 2750
I made this regex demo (working) here: https://regex101.com/r/WSwEbY/6
When I use it in notepad ++, it doesn't work with multiple lines:
hello ladies how are you Today
hello ladies how are you Today
-> result is on a single line:
helloLadiesHowAreYouTodayHelloLadiesHowAreYouToday
Informations:
search: [^\w]+(\w)
replaceby: \U$1
n++version: 7.5.8
I also try to check 'multiline' or add '$' to en of the search.
Upvotes: 0
Views: 102
Reputation: 370699
In addition to not matching newlines in the repeated character set, you should also alternate with a check for if you're at the start of a line - that way the first word on a line will be capitalized as well. Use the m
flag so that ^
matches the start of a line:
(?:^|[^\w\n]+)(\w)
Replace with:
\U$1
Output:
HelloLadiesHowAreYouToday
IAmFineThankYou
https://regex101.com/r/dsOcOD/1
Upvotes: 0
Reputation: 50443
How about matching just the space or the start(^
) with multiline flag?
(?:^| +)(\w)
sub:
\U$1
Upvotes: 0