![](/img/trans.png)
[英]How do I delete everything after the 3rd 4rth occurrence of a character using sed/grep/regex
[英]How do I remove everything beyond the second occurrence of a character using Regex?
我有一個類似的列表:
xxxxx|xxxxxx|xxxxx@example.com
xxxxx|xxxxxx|xxxxx@example.com
xxxxx|xxxxxx|xxxxx@example.com
x 既可以是字母也可以是數字,但不能是別的。
我要做的是替換第二個右側的所有內容(包括字符) |
. 結果應如下所示:
xxxxx|xxxxx
我想用正則表達式來做,這樣我就可以替換 Notepad++ 中的所有出現。
將\|[^\|]+$
替換為空。
這將匹配|xxxxx@example.com
,所以如果你用空白字符串替換它,那將完成你想要的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.