誰か次の正規表現について手伝ってもらえませんか。
電話番号だけを残して、残りの行を削除したいです。
Name: Text here
DOB: Text here
Address: Text here
Tel: 1234 567890
私が欲しいもの:
1234 567890
(「電話」なし)
答え1
- Ctrl+H
- 検索対象:
\A.*Tel: ([\d\h]+)|.*?
- と置換する:
$1
- チェック マッチケース
- チェック 包み込む
- チェック 正規表現
- チェック
. matches newline
- Replace all
説明:
\A # beginning of file
.* # 0 or more any character
Tel: # literally
([\d\h]+) # group 1, 1 or more digit or space
| # OR
.*? # 0 or more any character, not greedy
交換:
$1 # content of group 1, the phone number
スクリーンショット(前):
スクリーンショット(後):