
![]() |
perkiset
^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}
Note that this is case sensitive as is. If for example you were doing this in PHP, you'd reference it this way:preg_match_all('/([A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4})/i', $inputBuff, $emails); ... it's the lowercase letter I after the closing / that says "Case Insensitive." In this example we are trying to grab all emails we see in $inputBuff and put them into the array $emails. Bompa
Hi Perk,
What is this thing you call $inputBuff? Where does it come from? What else might be in it? Bompa cdc
$inputBuff is just the variable he's using in the example. So to answer your question, it would be the data that you're trying to determine if it's a valid email or not.
The parameters for preg_match_all (a PHPfunction) are:1. The regex2. The string to perform the regexon3. The output array More info here: http://www. php.net/preg_match_allBompa
Ah, but perk said "extract", not "validate", so I was thinking what if we wanted to
get an email off of a web page? ![]() but actually, i was just looking for a reason to post. :rofl: Bompa (is it just my connection, or is this forum slow?) cdc
As usual, perk is right. The code will extract all the emails from inputbuff, so if inputbuff is a webpage, you can grab all the emails off it.
My mistake. Sorry for the confusion. perkiset
Sorry I was not clear - yes, $inputBuff is just a variable I chose -
it sounded better than $webPageIAmHarvestingFrom ![]() Caligula
Ohhh I have one of these too!
simple - basic.. heres the whole code... <? php$file = file_get_contents("http://www.yoursite.com"); if( $file ) { preg_match_all( '/<a href="mailto ![]() foreach( $output as $item ) { echo "$item[1]<br>"; } } ?> |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads