开发者

Select line of text starting with something via Regular Expressions

I need a way to select "h开发者_Go百科1" everything after "h1" to replace it to nothing using regular expressions. I also need it to work for @import.

I need to change this:

    <link href='http://fonts.googleapis.com/css?family=Special+Elite' rel='stylesheet' type='text/css'>
    h1 { font-family: 'Special Elite', arial, serif; }
    @import url(http://fonts.googleapis.com/css?family=Special+Elite);
    <link href='http://fonts.googleapis.com/css?family=Quattrocento+Sans' rel='stylesheet' type='text/css'>
    h1 { font-family: 'Quattrocento Sans', arial, serif; }
    @import url(http://fonts.googleapis.com/css?family=Quattrocento+Sans);
    <link href='http://fonts.googleapis.com/css?family=Smythe' rel='stylesheet' type='text/css'>
    h1 { font-family: 'Smythe', arial, serif; }
    @import url(http://fonts.googleapis.com/css?family=Smythe);

To this:

    <link href='http://fonts.googleapis.com/css?family=Special+Elite' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Quattrocento+Sans' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Smythe' rel='stylesheet' type='text/css'>


This one should match on the lines you want to keep:

(<link.*css'>)

And this one should match on the lines you want to delete:

(h1 {.*})|(@import.*;)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜