I've retrieved a CSS rule from document.styleSheets and am looking now to extract it's properties and values.
cssText = ".expl { position: absolute; background-color: rgb(204, 204, 204); max-width: 150px; }";
Is it possible with regular expressions to retrieve the properties and their appropriate values within a match? Plus, strip the trailing semi-colon.
I want to get the result as follows:
position: absolute // match 1
background-color: rgb(204, 204, 204) // match 2
max-width: 150px // match 3
I've only got to the point where I'm extracting what's within the brackets: (?<={)(.*)(?=}), have no clue with what should I continue.
How do I achieve this?
Thanks in advance!


cssText = "position: absolute; background-color: rgb(204, 204, 204); max-width: 150px; "