Raf's Lab

Wednesday May 19, 2010

Regex: Removing class attributes from XML/XHTML

If you have ever needed to remove class attributes from xml/xhtml, then the following regex might save you some time


find: ( class="[\w-^"]*")
replace:

Please note that [\w^"] will fail, as the "-" dash character is not included, something I spent a little time on :O)

Comments:

Post a Comment:
  • HTML Syntax: Allowed

Calendar

Search

Twitter

Feeds

Links

Navigation

Referrers