开发者

Select line of text starting with something via Regular Expressions

开发者 https://www.devze.com 2023-02-28 16:35 出处:网络
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 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

精彩评论

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