I am trying to create a .NET Regex to parse a CSS font declaration, which takes following form:
font: italic small-caps bold xx-small 3.0em "Times New Roman", Times, serif;
According to the CSS specification, all of the elements of the declared value are optional, and I have successfully created Regexes that match the first five elements (in all their different permitted forms), but I am having trouble creating a Regex that matches the list of font names, which is always the last element in the property value. I don't need to identify the individual elements in the font names list; I just want to match the list as a whole.
The font names list is comma separated list (with optional whitespace between elements) and each member of the list is either a single-word name or multiple words enclosed in quotes.
So far, I have come up with the following expression ...
(?<NAME_LIST>(?<QUOTED_NAME>"[\w ]+")|(?<SIMPLE_NAME>\w+)(?:,\s*(?<QUOTED_NAME>"\w ]+")|(?<SIMPLE_NAME>\w+))*)
... but it matches each member of the list individually, instead of matching the entire list.
Any ideas would be appreciated.
Thanks,
Tim