I have a big CSS file with all CSS we need for our internal framework, but I only need a few of the styles. So I want to extract the style I want. I used regular expression to extract them:
cssFileContent.scan(/\.#{cssName}.*?\{.+?\}/im)
In Ruby, scan means extract the patter from string, cssName is the CSS style name
i - case insensitive
m - dot match everything so that \n will be matched too
It gives me some style blocks, but skip one every time. For example, I have .abc-style { } and .def-style { }, but result is like:
.abc-style {
}
}
so def-style is skipped.
Can someone give me any point why? And how to correct?