This is a font declaration in css:
font: bold italic small-caps 1em/1.5em verdana,sans-serif;
This is a regexp that is working to get the value in px:
value.match(/(normal|italic)?\s*(normal|small-caps)?\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\s*(\d+)px(?:\/(normal|[\d\.]+))?\s+(.*)/);
And helps me getting this:
var fontStyle = match[1],
// font variant is not used
// fontVariant = match[2],
fontWeight = match[3],
fontSize = match[4],
lineHeight = match[5],
fontFamily = match[6];
I would like to parse any value for font size or lineheight non just px, but
[px|cm|mm|em|pt|pc|in]
But i'm not able to modify it. Can someone help?
Final result:
(normal|italic)?\s*(normal|small-caps)?\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\s*(\d+(?:px|cm|mm|em|pt|pc|in)*)(?:\/(normal|[\d\.]+))?\s+(.*)
vh,vw,vminandvmax?