Community
    • Login

    find a string and move to new line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.9k 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.
    • Sudhir0103S
      Sudhir0103
      last edited by PeterJones

      I would like split line into a new line after finding a specific character

      Eg.

      edit "*.pokotalks.com" set type fqdn set fqdn "*.pokotalks.com"
      

      should become like below

      edit "*.pokotalks.com"
      set type fqdn 
      set fqdn "*.pokotalks.com"
      

      —

      moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Sudhir0103
        last edited by PeterJones

        @Sudhir0103 ,

        You don’t say what the “specific character” is, and there is no specific character in your example data. But if what you want is to convert space character followed by set to newline sequence followed by set (but only if set is a whole word, not the start of some other word like setting), an easy way to do that is:

        • FIND WHAT = \x20set\b
          • the \x20 means the space character; if you wanted, you could just type a space as the first character in FIND WHAT, but it’s hard to copy/paste unnoticed space character from the forum, so I use the escape sequence instead
          • the \b is what keeps it matching set but not setting
        • REPLACE WITH = \r\nset
          • \r\n is the windows CRLF line ending.
        • SEARCH MODE = Regular Expression
        • Click REPLACE ALL

        There are other ways to do it, but this one is pretty easy for a regex (regular expression) newbie to understand

        (update: fixed from saying wrong \x32 to right \x20)

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors