Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

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

    Help wanted · · · – – – · · ·
    2
    3
    56
    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.
    • mpmuskie20
      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 Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @mpmuskie20 last edited by

        @mpmuskie20

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

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

          @Alan-Kilborn Thanks! Worked a treat!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors