Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #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
Reply With Quote
  #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;











Reply With Quote
  #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$"
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 06: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 04:33 AM
Regular Expression Help Hadware .NET Web Services 3 November 4th, 2003 09:51 AM



All times are GMT -4. The time now is 07:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.