mate you rock..

Martin Towell wrote:

> try this - 
> 
> $the_array = spliti("<a ", $html);
> $the_array = preg_grep("</a>", $the_array);
> foreach($the_array as $k)
>   echo ereg_replace("</a>.*", "", $k)."\n";
> 
> 
> -----Original Message-----
> From: Jack Dempsey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 30, 2001 2:30 PM
> To: brendan; [EMAIL PROTECTED]
> Subject: RE: [PHP] @#$@# Reg Expressions
> 
> 
> brendan, please clarify: you're "trying to strip out all links in the page
> that is between
> the <a href and </a>"
> 
> you're trying to strip out all links and return them?
> if so, split won't work.....it splits on whatever the pattern is.....
> if you're trying to get all the links, you could do [this doesn't get <a
> name which is what you want i think]
> 
> preg_match_all("|(<a href.*?</a>)|",$html,$matches);
> 
> look at the preg_match_all page at php.net for info on how to use it
> 
> 
> ITE($url);
> 
> $the_array=spliti("<A (.*)</A>", $html,-1); //spliti to avoid any case
> sensitivity.
> foreach($the_array AS $k) echo $k."<HR>";
> 
> I had given preg_split a go but just got flummoxed with the need to
> slash everything ..
> 
> 
> Martin .. I'd tried that .. but i get an array count of 0 from
> $the_array ..(from $the_array=split("<A ([^>]*)</A>", $html,-1);
> 
> 
> 
> echo count($the_array);
> 
> Jack Dempsey wrote:
> 
> 
>>ok, are you trying to get the links returned or just split on them? i
>>
> missed
> 
>>your original post.
>>watch your caps as well...
>>
>>i'd use preg_split also
>>
>>jack
>>
>>-----Original Message-----
>>From: brendan [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, October 29, 2001 9:59 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] @#$@# Reg Expressions
>>
>>
>>thanks but it didnt work either ..  ;)
>>
>>Matt Friedman wrote:
>>
>>
>>
>>>Try putting a "?" after your quantifier for "non-greedy" matching.
>>>
>>>Something like: $the_array=split("<A (.*?)</A>", $html,-1);
>>>
>>>Matt.
>>>
>>>
>>>
>>>----- Original Message -----
>>>From: "brendan" <[EMAIL PROTECTED]>
>>>To: <[EMAIL PROTECTED]>
>>>Sent: Monday, October 29, 2001 7:55 PM
>>>Subject: [PHP] @#$@# Reg Expressions
>>>
>>>
>>>
>>>
>>>
>>>>love em.. right now I hate em..
>>>>
>>>>can someone inform me why the below doesnt work?
>>>>it is intended to strip out all the links in a page and return an array
>>>>.. insanity is just starting to set in..
>>>>
>>>>cheers
>>>>
>>>>$html =GETSITE($url);
>>>>// and put in a new line break behind every anchor tag
>>>>$the_array=spliti("<A (.*)</A>", $html,-1);
>>>>echo $the_array ;
>>>>foreach($the_array AS $k) echo $k."<HR>";
>>>>}
>>>>
>>>>
>>>>--
>>>>PHP General Mailing List (http://www.php.net/)
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to