Community
    • Login

    Move word with notpad++

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 4 Posters 608 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.
    • faouzi satF
      faouzi sat
      last edited by

      I have this :
      :10001 80.241.223.31
      :5500 89.44.113.207
      :5555 164.142.44.189
      :5500 80.241.154.87
      :20000 142.227.138.30
      :7777 5.240.23.28
      :7777 78.41.71.186
      :5500 38.242.243.181

      i want to get Ip:port
      like this :

      80.241.223.31:10001
      89.44.113.207:5500
      164.142.44.189:5555
      80.241.154.87:5500
      142.227.138.30:20000
      5.240.23.28:7777
      78.41.71.186:7777
      38.242.243.181:5500

      Terry RT PeterJonesP 2 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @faouzi sat
        last edited by

        @faouzi-sat said in Move word with notpad++:

        i want to get Ip:port
        like this :

        So what have you tried? It is a fairly easy one to solve using regular expression and should be one that even someone who has had little experience, to be able to solve.

        Terry

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

          @Terry-R

          But maybe really difficult for someone with absolutely no exposure to regular expressions?

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

            @faouzi-sat ,

            Here’s your freebie, since this was your first post. And I appreciate that you showed before-and-after data, even if you neglected the </> button to mark your text as plaintext. But as Terry was encouraging you, you will get better help (and learn more) if you put in more effort when asking for help.

            So, in Regular Expression search mode,

            • : matches a literal colon
            • \d+ matches one or more digits
            • \. matches a literal dot/period/fullstop character
            • putting () parentheses around an expression will save it in the next capture group number

            And in the replacement, $1 references the first capture group number.

            Putting that all together: put a colon and one or more digits in group#1 and the sequence of digits-dot-digits-dot-digits-dot-digits in group#2, and replace with group2-then-group1

            • FIND = (:\d+) (\d+\.\d+\.\d+\.\d+)
            • REPLACE = $2$1

            ----

            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
            faouzi satF 1 Reply Last reply Reply Quote 0
            • faouzi satF
              faouzi sat @PeterJones
              last edited by

              @PeterJones said in Move word with notpad++:

              @faouzi-sat ,

              Here’s your freebie, since this was your first post. And I appreciate that you showed before-and-after data, even if you neglected the </> button to mark your text as plaintext. But as Terry was encouraging you, you will get better help (and learn more) if you put in more effort when asking for help.

              So, in Regular Expression search mode,

              • : matches a literal colon
              • \d+ matches one or more digits
              • \. matches a literal dot/period/fullstop character
              • putting () parentheses around an expression will save it in the next capture group number

              And in the replacement, $1 references the first capture group number.

              Putting that all together: put a colon and one or more digits in group#1 and the sequence of digits-dot-digits-dot-digits-dot-digits in group#2, and replace with group2-then-group1

              • FIND = (:\d+) (\d+\.\d+\.\d+\.\d+)
              • REPLACE = $2$1

              ----

              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

              Working !

              thanks

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