This script I wrote works with tables, td's and div's, but not with
style tags. Can anyone figure out the regular expression for finding
<styletags. The trick is that sometimes its not just <style Its
<style type="text/css">
Basically, i want to take the information in between the style content
from any url
<?php
$url = "http://www.anyurlwiths tyletags.com";
$html = file_get_conten ts($url);
//preg_match_all( "/<style.*style >/", $html, $matches);
preg_match_all( "/<div.*div>/", $html, $matches);
//preg_match_all( "/[\s]*[<style>][\s]*[\w]*[\s]*[<\\style>][\s]*/",
$string, $matches);
//preg_match_all( "/(\<[
\\n\\r\\t]{0,}style[^>]*\>|\<[^>]*[\\n\\r\\t]{1,}style[^>]*\>){1}([^<]*<([^(\/>)]*(\/[^(t>)]){0,1}(\/t[^(r>)]){0,1})*>)*(\<[
\\n\\r\\t]{0,}\/tr[^>]*\>|\<[^>]*[\\n\\r\\t]{1,}\/style[^>]*\>){1}/i",
$html, $Matches);
foreach($matche s[0] as $div) {
echo $div;
}
?>
style tags. Can anyone figure out the regular expression for finding
<styletags. The trick is that sometimes its not just <style Its
<style type="text/css">
Basically, i want to take the information in between the style content
from any url
<?php
$url = "http://www.anyurlwiths tyletags.com";
$html = file_get_conten ts($url);
//preg_match_all( "/<style.*style >/", $html, $matches);
preg_match_all( "/<div.*div>/", $html, $matches);
//preg_match_all( "/[\s]*[<style>][\s]*[\w]*[\s]*[<\\style>][\s]*/",
$string, $matches);
//preg_match_all( "/(\<[
\\n\\r\\t]{0,}style[^>]*\>|\<[^>]*[\\n\\r\\t]{1,}style[^>]*\>){1}([^<]*<([^(\/>)]*(\/[^(t>)]){0,1}(\/t[^(r>)]){0,1})*>)*(\<[
\\n\\r\\t]{0,}\/tr[^>]*\>|\<[^>]*[\\n\\r\\t]{1,}\/style[^>]*\>){1}/i",
$html, $Matches);
foreach($matche s[0] as $div) {
echo $div;
}
?>
Comment