Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
| Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 29th, 2004, 11:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default regular expression

hi there

another silly question to ask.... what would be the regular expression syntax for any email address ending ONLY with ".edu"???



the genuine genius
__________________
www.campusgrind.com - college portal
  #2 (permalink)  
Old April 29th, 2004, 02:05 PM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

found a solution

<?php
include ("header.php");
?>
<html>
<body>
<?php
$name='';
$value='';
if($HTTP_POST_VARS){
    while(list($lvar,$lvalue)=each($HTTP_POST_VARS)){
        if ((ereg("[^1]$",$lvar)) && (ereg("[^\d\w]$",$lvalue))){ //if var does not end in a 1 and

                                        //value not null
        //echo "$lvar=$lvalue<br>"; //echo the var and its value
        //echo "$lvar ";
        //$statement=$lvar;
        //echo "$statement<br>";
        $name=$name . $lvar . ","; //built var string
        $value=$value . $lvalue . "','";
        }
        //echo "$lvalue ";
    }
}
$length=strlen($name); //get length of string
$name=Substr($name,0,($length-1));
$name="($name)"; //strip out last comma
echo "$name<br>";
$length2=strlen($value);
$value=Substr($value,0,($length2-2));
$value="('$value)";
echo "$value<br>";
$sql="INSERT into msdsmasterlist $name VALUES $value ";
$result=mysql_query($sql);
echo $sql;
$num_rows=mysql_affected_rows();
echo $num_rows;
$errors=mysql_error();
echo $errors;











  #3 (permalink)  
Old April 30th, 2004, 04:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm. It may be a solution, but it does not seem to be a solution to Moharo's problem.

Moharo, is this any good to you?

"^[a-z0-9\._-]+@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?edu$"
  #4 (permalink)  
Old April 30th, 2004, 04:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

big thanx mr. Walker... peace

:D

the genuine genius


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Help Please rstelma ASP.NET 1.0 and 1.1 Professional 0 January 2nd, 2008 07:01 PM
REGULAR EXPRESSION pallone Javascript How-To 0 September 5th, 2006 06:52 AM
regular expression if-then smay Javascript 4 July 5th, 2005 12:10 PM
Regular Expression Help Greg Griffiths Javascript How-To 4 November 12th, 2004 05:33 AM
Regular Expression Help Hadware .NET Web Services 3 November 4th, 2003 10:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.