Community
    • Login

    Replace all places of text that contain ips in brackets with nothing

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    10 Posts 4 Posters 4.4k Views 3 Watching
    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.
    • Patrik TammP Offline
      Patrik Tamm
      last edited by Patrik Tamm

      Title! I need help and it would be appreciated!

      “max100:[216.36.165.77]naconnin” is one of the examples

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • Claudia FrankC Offline
        Claudia Frank @Patrik Tamm
        last edited by

        @Patrik-Tamm

        use regular expression checked,

        find what:

         \[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]
        

        replace with:

        []
        

        \d looks for any digit
        {1,3} means digit must occur at least once and at most 3 times
        the dot needs to be escaped by backslash if it sholud be used literally, same applies to [ and ]

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 1
        • Patrik TammP Offline
          Patrik Tamm
          last edited by

          @Claudia-Frank said:

          []

          Hello Claudia, it doesn’t seem to work. It throws me that nothing was replaced. Is it possible that it would delete all of the stuff inside the brackets?

          Claudia FrankC 1 Reply Last reply Reply Quote 1
          • Claudia FrankC Offline
            Claudia Frank @Patrik Tamm
            last edited by

            @Patrik-Tamm

            Is you cursor set on first line?
            Do you use wrap around setting with file dialog?

            Cheers
            Claudia

            Patrik TammP 1 Reply Last reply Reply Quote 1
            • Patrik TammP Offline
              Patrik Tamm
              last edited by

              Thank You, it worked!

              1 Reply Last reply Reply Quote 1
              • Patrik TammP Offline
                Patrik Tamm @Claudia Frank
                last edited by

                @Claudia-Frank

                Wait, it doesn’t still seem to delete everything inside the brackets. Sorry for your time but is it possible to make that it will find the brackets and remove everything inside them?

                Claudia FrankC 2 Replies Last reply Reply Quote 0
                • Claudia FrankC Offline
                  Claudia Frank @Patrik Tamm
                  last edited by

                  @Patrik-Tamm

                  it would delete IP’s, is there anything else inside?
                  If so, what COULD be inside?

                  Cheers
                  Claudia

                  Scott SumnerS 1 Reply Last reply Reply Quote 0
                  • Claudia FrankC Offline
                    Claudia Frank @Patrik Tamm
                    last edited by Claudia Frank

                    @Patrik-Tamm

                    or the other way, is only the text inside the brackets which should be deleted?

                    If so, find

                    \[.*\]
                    

                    and replace with

                    []
                    

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • Scott SumnerS Offline
                      Scott Sumner @Claudia Frank
                      last edited by

                      @Claudia-Frank

                      I could tell from the very first posting that things were going to go the way they have…

                      1 Reply Last reply Reply Quote 0
                      • guy038G Offline
                        guy038
                        last edited by guy038

                        Hi, @patrick-tamm, @claudia-frank and @scott-sumner,

                        Claudia, regarding your last regex, it would better to use a lazy quantifier, just in case of lines, as below :

                        This is [an example] of text with [some pairs] of square brackets, in the [same line] !
                        

                        So a correct regex S/R should be :

                        SEARCH : \[.*?\]

                        REPLACE : []

                        OPTIONS : Regular expression and Wrap around and, maybe, . matches newline if brackets pair are split on two different lines !

                        ACTION : Click on the Replace All button

                        Cheers,

                        guy038

                        1 Reply Last reply Reply Quote 1

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors