How do i delete everything except the square brackets
-
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
accusamSorry 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 -
Hi there.
I figured out this much before my head started hurting:
Find What:
[^\[\]]*\[([^\]]+)\]
Replace:\1\nIt 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. -
Couldn’t let it go…
Find What:[^\[\]]*\[([^\]]+)\]|.*$
Replace:\1\nDon’t forget to enable “Regular expression” - then click “Replace All”.
-
-
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] blabalawill break your logic.
Cheers
Claudia
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