Delete everything except a word
-
Hello guys. I have hours searching for a way in regex to delete everything in a line except a certain text. It will be something like this:
Before:
Caracas
Caracas
UNUSABLE TEXT Caracas UNUSABLE TEXT
CaracasAfter:
Caracas
Caracas
Caracas
CaracasI have make so many tests with this:
Find: .(text_you_need_to_keep).
Replace: $1
But i cant get it to work. Pls help me
-
@P4R0D-Y :
find:
(?-s)^.*?(Caracas).*
repl:${1}
-
Thank you for the answer. But idk if something its wrong with the text or what, because it doesnt deletes the other text around the word.
-
I guess you have to explain further because from what I can tell of your screenshot it worked to do what was requested. Now if you really wanted something else, that’s a different story.
-
I make the same question on Stackoverflow and heres the correct answer:
Thanks for your time anyways!
-
I gave you the answer to exactly what you asked here.
Now, if someone else interpreted your question differently and that interpretation lined up with yours, and worked for you, that’s great I guess.
Try to ask better questions, I guess is the moral of the story.