Wie kann man den gesamten Text löschen, außer was in Anführungszeichen steht?

625
Chibi

Ich möchte den gesamten Text mit Ausnahme der Anführungszeichen entfernen.

Wie würde ich das machen?

Beispiel:

Bran could hear the wind in the trees, the clatter of their hooves on the ironwood planks, the whimpering of his hungry pup, but Jon was listening to something else. “There,” Jon said. He swung his horse around and galloped back across the bridge. They watched him dismount where the direwolf lay dead in the snow, watched him kneel. A moment later he was riding back to them, smiling. “He must have crawled away from the others,” Jon said. “Or been driven away,” their father said, looking at the sixth pup. His fur was white, where the rest of the litter was grey. His eyes were as red as the blood of the ragged man who had died that morning. Bran thought it curious that this pup alone would have opened his eyes while the others were still blind. “An albino,” Theon Greyjoy said with wry amusement. “This one will die even faster than the others.” Jon Snow gave his father’s ward a long, chilling look. “I think not, Greyjoy,” he said. “This one belongs to me.”

Benötigtes Ergebnis:

“There,” “He must have crawled away from the others,” “Or been driven away,” “An albino,” “This one will die even faster than the others.” “I think not, Greyjoy,” “This one belongs to me.”

Oder

There, He must have crawled away from the others, Or been driven away, An albino, This one will die even faster than the others. I think not, Greyjoy, This one belongs to me.

2

2 Antworten auf die Frage

0
RProgram

Im CudaText- Editor können Sie dies mit Mehrfachauswahl tun.

  • Dialog Suchen, Eingeben ".+?", Überprüfen der Reg-Ex-Option
  • Klicken Sie im Dialog auf "Alle auswählen"
  • Text in Anführungszeichen wird ausgewählt, In Zwischenablage kopieren
  • Neue Datei erstellen, Einfügen aus der Zwischenablage

Verwenden Sie den CudaExt- Plugin-Befehl "Ausgewählte Zeilen verbinden", um die resultierenden Zeilen zu einer zu verbinden.

0
Toto
  • Ctrl+H
  • Finde was: (?:^|\G)[^“”]*(“[^”]*”)
  • Ersetzen durch: $1 ( Hinweis: Es gibt ein Leerzeichen vor$1 )
  • Aktivieren Sie die Option Wrap around
  • Überprüfen Sie den regulären Ausdruck
  • Replace all

Erläuterung:

(?:^|\G) : non capture group, beginning of line or posiiton of last match [^“”]* : 0 or more any character that is not “ or ” ( : start group 1 “ : opening “ [^“”]* : 0 or more any character that is not “ or ” ” : closing ” ) : end group 

Sie können “([^”]*)”anstelle von verwenden, (“[^”]*”)wenn Sie die Anführungszeichen nicht im Ergebnis verwenden möchten.

Ersatz:

 $1 : a space followed by content of group 1 

Ergebnis für gegebenes Beispiel:

„Dort“, „Er muss von den anderen gekrochen sein“, „Oder wurde vertrieben“, „Ein Albino“, „Dieser wird noch schneller sterben als die anderen.“ „Ich denke nicht, Greyjoy“, „Dieser hier gehört mir."