Glam Prestige Journal

Bright entertainment trends with youth appeal.

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
1

2 Answers

It's more efficient without capturing groups.

  • Ctrl+H
  • Find what: \?\h+\K(?=[A-Z])
  • Replace with: \n # you can use \r or \r\n depending 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 after

Screen capture (before):

enter image description here

Screen capture (after):

enter image description here

3

try:

(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)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy