Notepad ++ URLからテキストを削除する方法

Notepad ++ URLからテキストを削除する方法

これを 1 時間試してみましたが、適切な正規表現が見つからないようです。何かアイデアはありますか?

これ:

src="https://www.mywebsite.com/embedframe/84398934/need-this-text-and-the-forward-slash-before-it-removed" フレームボーダー="0" 幅="600" 高さ="400" スクロール="no" allowfullscreen="allowfullscreen">

これに対して:

src="https://www.mywebsite.com/embedframe/84398934" フレームボーダー="0" 幅="600" 高さ="400" スクロール="いいえ" allowfullscreen="allowfullscreen">

答え1

Notepad++ を使用する (Notepad は正規表現をサポートしていません):

  • Ctrl+H
  • 検索対象:src="https://.*\K/[^/"]+(?=")
  • と置換する:LEAVE EMPTY
  • チェック ラップアラウンド
  • 正規表現をチェック
  • Replace all

説明:

src="https://   # literally
.*              # 0 or more any character
\K              # forget all we have seen until this position
/               # a slash
[^/"]+          # 1 or more any character that is not slash or double quote
(?=")           # positive lookahead, make sure we have a double quote after

与えられた例の結果:

src="https://www.mywebsite.com/embedframe/84398934" frameborder="0" width="600" height="400" scrolling="no" allowfullscreen="allowfullscreen">

画面キャプチャ:

ここに画像の説明を入力してください

関連情報