- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Capture bgcolor attribute for replacing with style attribute
Variable 1 = "complete attribute and value". Variable 2 = "attribute value only". For meeting compliance with W3C AA rules, I've been using this in a simple HTML parser to convert certain background tags from the deprecated 'bgcolor' attribute to now using a 'style=background:' and the passed colour. This had to be only on hexadecimal values for my current needs. Later modifications : 1. Only for certain tags (eg. td,tr,table). 2. If matching an opening apostrophe/quotation mark, only capture variable if there is a closing one.
table bgcolor="#A3A3A3" | table bgcolor= #A3A3A3" | td bgcolor= #A3A3A3 | td bgcolor=#A3A3A3 alt="somethingelse"
tr bgcolor="" test | tablebgcolor="#A3A3A3" | table bgcolor="test2" | td bgcolor="red" | td bgcolor="#$%skis"
Author Rating: The rating for this expression. Tom Meier
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2018, | ASP.NET Tutorials