質問: 引用符で囲まれているものを除くすべてのテキストを削除するにはどうすればよいですか? 引用符で囲まれているものを除いて、すべてのテキストを削除したい。どうすればそれを行うことができますか?例: 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.
回答: 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 _与えられた例の結果: 「そこに」「彼は他の人から這い去ったに違いない」「あるいは追い払われた」「アルビノ」「これは他の人よりも早く死ぬだろう」 「私はそうは思わない、グレイジョイ」「これは私のものだ」