it-swarm-ja.com

引用符で囲まれているものを除くすべてのテキストを削除するにはどうすればよいですか?

引用符で囲まれているものを除いて、すべてのテキストを削除したい。

どうすればそれを行うことができますか?

例:

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.”

必要な結果:

“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.”

または

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.

4
Chibi
  • Ctrl+H
  • 何を見つける:_(?:^|\G)[^“”]*(“[^”]*”)_
  • 置換:_$1_(注:_$1_)の前にスペースがあります
  • ラップアラウンドをチェックしてください
  • 正規表現を確認してください
  • Replace all

説明:

_(?:^|\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
_

結果に引用符を含めたくない場合は、_(“[^”]*”)_の代わりに“([^”]*)”を使用できます。

交換:

_ $1         : a space followed by content of group 1
_

与えられた例の結果:

「そこに」「彼は他の人から這い去ったに違いない」「あるいは追い払われた」「アルビノ」「これは他の人よりも早く死ぬだろう」 「私はそうは思わない、グレイジョイ」「これは私のものだ」

1
Toto

CudaText エディターでは、複数選択でそれを行うことができます。

  • ダイアログ検索、入力".+?"、正規表現オプションを確認してください
  • ダイアログで「すべて選択」を押します
  • 引用符内のテキストが選択されている、クリップボードにコピー
  • 新しいファイルタブを作成し、クリップボードから貼り付けます

結果の行を1つに結合するには、CudaExtプラグインのコマンド「選択した行を結合」を使用します。

0
RProgram