Example
That is so good isn't it? Yes it is
I want to find a question mark that is followed by a space and an upper case letter. Then replace it with:
That is so good isn't it?
Yes it is
I have tried various ways to no avail.
- FIND:
? ([A-Z]) - REPLACE:
?\r\r
2 Answers
It's more efficient without capturing groups.
- Ctrl+H
- Find what:
\?\h+\K(?=[A-Z]) - Replace with:
\n# you can use\ror\r\ndepending on the platform - CHECK Match case
- CHECK Wrap around
- CHECK Regular expression
- Replace all
Explanation:
\? # question mark, have to be escaped
\h+ # 1 or more horizontal spaces
\K # forget all we have seen until this position
(?=[A-Z]) # positive lookahead, make sure we have a capital afterScreen capture (before):
Screen capture (after):
3try:
(enable "match case")
(find) \? ([A-Z].*)
(replace) \? \n\1
(note: \ is used to escape special control characters)
\? : the literal string "?" followed by a space
( and ) parens creates a group which can be referenced
. means any character and .* means any character zero or more times
\1 is referencing the first group reference (the parens)