| 
	
 | 
 Posted by ameshkin on 09/09/06 05:44 
Holy shit it works...but, I will test this some more.   What if there 
is more than one instance of the style tag.  Do i have to do something 
like this? 
 
foreach($match[0] as $div) { 
 echo $div; 
} 
 
and for the second one 
 
foreach($match[1] as $div) { 
 echo $div; 
} 
 
I will experiment a little.  If you can't tell, i only have about 6 
months of PHP experience.  Pretty much self taught.  Thank yo sooo 
much, you save dme hours of HORRIBLE regular expression reading and 
figuring out! 
 
 
Rik wrote: 
> Rik wrote: 
> > ameshkin wrote: 
> >> 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 
> >> <style> tags.  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 
> >> 
> > 
> > Well, for stasters it's closed with </style>, not <\style>.... 
> > 
> > 
> > preg_match_all('|<style[^>]*?>(.*?)</style>|si',$html,$matches); 
> 
> preg_match_all('|<style[^>]*>(.*?)</style>|si',$html,$matches); 
> is better here... 
>  
> --  
> Rik Wasmus
 
  
Navigation:
[Reply to this message] 
 |