Re: Trying to craft a regexp
| From: | Burhan Khalid | Date: | Fri, 31 Oct 2003 11:51:23 +0000 |
| Subject: | Re: Trying to craft a regexp | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168218@lists.php.net to get a copy of this message | ||
Manuel Vázquez Acosta wrote:
Hi all: I'm trying to find every simple mail address in an HTML that is not inside an A tag. I have tried this regexp: (?<!maito\:)(\w+@\w+(?:\.\w+)+)(?![^<]*?</a>)Try this (a little more comprehensive) : preg_match_all("|<a(.*?)href=[\"'](.*?)[\"'](.*?)>(.*?)</a>|i", $rawHTML, $arrayoflinks); $links = array_unique($arrayoflinks[0]); $href = array_unique($arrayoflinks[2]); //href= $text = array_unique($arrayoflinks[4]); //link text $text, $href, etc. are arrays. You can print_r() to find out what they contain. -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com