Navigation

    Community

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

    How do i delete everything except the square brackets

    Help wanted · · · – – – · · ·
    3
    5
    2118
    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.
    • H3ker001
      H3ker001 last edited by

      Dear community,

      how do i delete the whole text / character etc, except the things what stands between the square brackets?

      Example text:

      Lorem ipsum [dolor] sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit [amet]. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et [accusam] et justo duo dolores et [ea] rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

      Filtered as a result come out:

      dolor
      amet
      ea
      accusam

      Sorry for my bad english, im german.


      In German:

      Hallo liebe Community,

      wie mache ich mit Notepad++ mittels RegExp den ganzen Text/Zeichen etc löschen außer die Sachen was zwischen den eckigen klammer steht?

      Beispiel Text:

      Lorem ipsum [dolor] sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit [amet]. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et [accusam] et justo duo dolores et [ea] rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

      gefiltert soll als Ergebnis sowas rauskommen:

      dolor
      amet
      ea
      accusam

      1 Reply Last reply Reply Quote 0
      • moon6969
        moon6969 last edited by

        Hi there.

        I figured out this much before my head started hurting:

        Find What: [^[]]*[([^]]+)]
        Replace: \1\n

        It gives what you want but just leaves the last line intact:

        dolor
        amet
        accusam
        ea
        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

        1 Reply Last reply Reply Quote 1
        • moon6969
          moon6969 last edited by moon6969

          Couldn’t let it go…
          Find What: [^[]]*[([^]]+)]|.*$
          Replace: \1\n

          Don’t forget to enable “Regular expression” - then click “Replace All”.

          Claudia Frank 1 Reply Last reply Reply Quote 3
          • H3ker001
            H3ker001 last edited by

            @moon6969 said:

            \1\n

            this is amazing ! ! ! thank you =) ) )

            1 Reply Last reply Reply Quote 0
            • Claudia Frank
              Claudia Frank @moon6969 last edited by

              @moon6969

              Hi, nice one but I guess there is little issue as you use

              [^[]]
              

              whereas, I believe, it should be

              [^[]
              

              because otherwise a text like

              blabla] blabla [needed_text] blabala
              

              will break your logic.

              Cheers
              Claudia

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