我有一個包含這樣的事情(這僅適用於節選)的文本文件:合併2正則表達式模式
Third Doctor
Season 7
051 Spearhead from Space 4 3—24 January 1970
052 Doctor Who and the Silurians 7 31 January—14 March 1970
053 The Ambassadors of Death 7 21 March—2 May 1970
054 Inferno 7 9 May—20 June 1970
Season 8
055 Terror of the Autons 4 2—23 January 1971
056 The Mind of Evil 6 30 January—6 March 1971
057 The Claws of Axos 4 13 March—3 April 1971
058 Colony in Space 6 10 April—15 May 1971
059 The Dæmons 5 22 May—19 June 1971
注意,基本路線模式是^###\t.*\t?\t.*$
(即幾乎每行有3個標籤\t
) 。
我想選段標題後刪除一切,所以它看起來像這樣:
Third Doctor
Season 7
051 Spearhead from Space
052 Doctor Who and the Silurians
053 The Ambassadors of Death
054 Inferno
Season 8
055 Terror of the Autons
056 The Mind of Evil
057 The Claws of Axos
058 Colony in Space
059 The Dæmons
目前我測試中的gedit以下模式:
([^\t]*)$ # replaces not only everything after the last `\t',
# incl that `\t', but also lines that *does not* contain any `\t'
然後我試圖以'選擇'的行,這應該是(?=(?=^(?:(?!Season).)*$)(?=^(?:(?!Series).)*$)(?=^(?:(?!Doctor$).)*$)(?=^(?:(?!Title).)*$)(?=^(?:(?!Specials$).)*$)(?=^(?:(?!Mini).)*$)(?=^(?:(?!^\t).)*$)(?=^(?:(?!Anim).)*$)).*$
- 正常工作,但我不知道如何將它與([^\t]*)$
相結合。
哪種語言? – vks 2014-11-02 20:34:30
@vks:我會說bash,但真的不知道gedit 3.10.4使用什麼樣的正則表達式...但是bash(sed)正則表達式已經足夠了:) – tukusejssirs 2014-11-02 21:47:30