On Nov 18, 2005, at 4:46 AM, Tod wrote:

> Is there a nice tool that anyone can recommend that will strip all  
> style
> tags from an html page?  A regex or java class would be nice but  
> I'm not
> picky.

This regex ought to find style tag blocks:

        <style\b.*?</style[^>]*>

This ought to  grab link tags for stylesheets and alternative  
stylesheets:

        <link[^>]+rel="(alternative )?stylesheet"[^>]*>

This ought to  grab style attributes on tags:

        \s+style="[^"]*"

All of these must be run case-insensitive on HTML (the link one must  
also for XHTML). There are things this doesn't account for, like  
single quotes instead of double quotes, and if your regex engine  
allows "." to match on a newline. Also, things like /* </style> */  
would trip it up.

-- 

     Ben Curtis : webwright
     bivia : a personal web studio
     http://www.bivia.com
     v: (818) 507-6613




______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to