I have a CSS file generated by some tool, and it's formatted like this:
@font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot?4px1bm');
src:url('fonts/icomoon.eot?#iefix4px1bm') format('embedded-opentype'),
url('fonts/icomoon.woff?4px1bm') format('woff'),
url('fonts/icomoon.ttf?4px1bm') format('truetype'),
url('fonts/icomoon.svg?4px1bm#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-pya:before {
content: "\e60d";
}
.icon-pyp:before {
content: "\e60b";
}
.icon-tomb:before {
content: "\e600";
}
.icon-right:before {
content: "\e601";
}
I want use a regular expression in Python to extract every CSS selector which starts with .icon- and its related value, e.g:
{key: '.icon-right:before', value: 'content: "\e601";'}
I only have basic regular expression knowledge, So I write this: \^.icon.*\, but it can only match the keys, not the values.