[PHP] PHP regular expression
Hello I found this function online and want to understand how it works. I don't understand /^ and $/. I know that ^ beginning of the string but what is /^. Thanks function validEmail($email) { return preg_match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+[a-zA-Z0-9_-]$/,$email); } _ Fast. Reliable. Get MSN 9 Dial-up - 3 months for the price of 1! (Limited-time Offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP regular expression
Hi list, I have a huge text file with many text on it. I'd like to know if someone can help in construct a regular expression to delete everything that not have this pattern Email: [EMAIL PROTECTED]. The part Email: is fixed and the email adress changes. I've tried many time to make the replace with PHP, but I'm very new to regular expression. Thank's Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP regular expression
Here is it $html = preg_replace('/?Email:\s+\w.*\.[\w.]*?/',,$html); I tested it and its working. On Tue, 12 Mar 2002, Rodrigo Peres wrote: Hi list, I have a huge text file with many text on it. I'd like to know if someone can help in construct a regular expression to delete everything that not have this pattern Email: [EMAIL PROTECTED]. The part Email: is fixed and the email adress changes. I've tried many time to make the replace with PHP, but I'm very new to regular expression. Thank's Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php [EMAIL PROTECTED] --- We must use time wisely and forever realize that the time is always ripe to do right. -- Nelson Mandela --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php