Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

CSS Matching

  •  04-16-2007, 4:00 PM

    CSS Matching

    I am working in Coldfusion trying to match CSS items that are NOT listed.

    For instance, I have this code to match:

       <div style='color:#444444;float:none;'>Test Text</div>

     

    I have the code matched down to:

       color:#444444;float:none;

     

    My regular expression to match CSS items is:

        ((?:^(background(?:-(?:top|bottom|left|right))?|border(?:-(?:top|bottom|left|right))?|clear|color|cursor|display|font-size|font-weight|(?:max-)?(?:height|width)|list-style|margin(?:-(?:top|bottom|left|right))?|overflow|padding(?:-(?:top|bottom|left|right))?|text-(?:align|decoration|indent|shadow|transform)|vertical-align))\:(?:[^\;]*\;|[\s]*))

     
    I want to match anything NOT listed (e.g. anything that is NOT (border with optional -top, -bottom, -left, etc OR clear OR color OR cursor OR etc.)).

    It is matching color on the first pass (which it should not do), but not matching float (which it should do). Items with optional stuff (like background and border) are not getting matched at all.

    The code returns the location within the string where the match was made (e.g. 'color' is matched at position 1 with a length of 14 [all characters up to the semicolon]).

    Any help?
     

View Complete Thread