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.*;)
精彩评论