Trying to get a regex that I can get a style attribute value from the example below should explain my issue.
source: font-size:11pt;font-color:red;text-align:left;
want to say give me ..
- font-size and returns 11pt
- font-colour and returns red
- text-align and returns left
Can someone point me in the right direction
Thanks
Lee
Logically you’d want:
[exact phrase] + 1 colon + 0 or more white space characters + 0 or more characters up to the first semicolon or closing quote.
I think this will get you headed in the right direction:
Gotchas:
the closing quote might be single or double and there may be a valid quote within (ie, quoting background image urls, for instance)
this is all dependent on the styles not being written in shorthand