PDA

View Full Version : Body Tag REGEX


mr_ego
11-14-2003, 05:43 AM
I'm trying to write a regular expression, that when you pass a body tag through to it, it gives you the colour of the background and the colour of text on that page in an Array.


So when you pass:

<body bgcolor="#FFFFFF" text="#000000">

You Get (after running print_r):

Array
(
[background] => #FFFFFF
[textcolour] => #000000
)


Any Ideas?

OR

Is there a function in PHP that changes html text into an Array? EG:


$_ITEM = Array(
"body => Array
(
"bgcolor" => #000000
"text" => #FFFFFF
)
);

Jeff Mott
11-14-2003, 08:08 PM
The HTML::Parser (http://www.perldoc.com/perl5.8.0/lib/HTML/Parser.html) module can do this for you.