Forum Moderators: coopster

Message Too Old, No Replies

Regular expression problem again.

regexs

         

anshul

11:43 am on Mar 8, 2006 (gmt 0)

10+ Year Member



Dear friends,

Its really hard to learn regexs.

I wanna find 'anchor text' for my Web site on other Web sites. For this,
1) I stored the content of external Web page in $document.
2) Only retained anchor tags by using strip_tags($content, '<a>').
3) Now, overall problem is to get anchor text, only for links that are my domain links.

Its not coming:


preg_match_all("/(<a\s*href=.*example\.com.\*>)(.*)(<\/a>)/", $document, $matches);
print_r($matches);

Please help.

[edited by: coopster at 5:54 pm (utc) on Mar. 8, 2006]
[edit reason] disabled graphic smileys [/edit]

coopster

5:46 pm on Mar 8, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Step 2 we assume you meant $document as opposed to $content, correct?