Community
    • Login

    regex to add new line after period, but only if followed by a capital character

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 549 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mpmuskie20M
      mpmuskie20
      last edited by

      Hello,
      I have some text that looks like this:
      Once upon a time, a princess lived in a beautiful castle.She was bored and wanted an adventure.Along came a prince who took her far from her home. Then she was happy to stay home.
      I need it to look like this:
      Once upon a time, a princess lived in a beautiful castle.
      She was bored and wanted an adventure.
      Along came a prince who took her far from her home. Then she was happy to stay home.

      Here is what I’ve tried:
      Search for: .[[:upper:]]
      replace with: .\r[[:upper:]]
      which resulted in:
      Once upon a time, a princess lived in a beautiful castle.
      [[:upper:]]he was bored and wanted an adventure.
      [[:upper:]]long came a prince who took her far from her home. Then she was happy to stay home.

      I only want a new line character if the period is followed by an uppercase character, not a space. Any help would be greatly appreciated.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @mpmuskie20
        last edited by

        @mpmuskie20

        Find: \.(?=\u)
        Replace: .\r\n
        Search mode: Regular expression

        mpmuskie20M 1 Reply Last reply Reply Quote 1
        • mpmuskie20M
          mpmuskie20 @Alan Kilborn
          last edited by

          @Alan-Kilborn Thanks! Worked a treat!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors