我有一个包含这样的事情(这仅适用于节选)的文本文件:合并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