Thanks for your reply.
I used the integer firstly because it was in a tut I was looking at and secondly because I find it an easy way for me to visualise the true false. I appreciate that it's not required but it's not going to mess up my code, is it?
I had a quick look at the preg/pcre info. I think I'd get it better if I had time to sit down and go through it properly but unfortunately time is of essence... and I'm a Flash designer by trade haha. Lord, I don't know what have I got myself into here I think I'll try again a little later and hopefully I can get the syntax down. I appreciate knowing that the eregi is going to be outdated soon, tho it's a bummer I've been wasting my time with it.
With the email sanitisation that you've quoted, how would I call it so I can do different things if it's true or false? Is it:
if (validate_email == "true"){
//true statement
}else{
//false statement
}
I'm not looking for something too specific, just something that will allow more than just .com adresses.
Re: Ken2k7, I believe filter_input() is available for me. I know my host uses a recent enough version of PHP for it, I can't check my clients because I don't have his login details at work, but I'm pretty sure it's the same as mine.
As for email format validation, this is a tough one.. You can read this post (Reply #3) to see links to an email parser already built for this very purpose. As for me personally, I don't even bother using strict email format validations and instead vouch for a much more relaxed filter_var in conjunction with FILTER_SANITIZE_EMAIL and FILTER_VALIDATE_EMAIL pre defined constants.
Example:
function validate_email($the_email){
return(filter_var(filter_var($the_email, FILTER_SANITIZE_EMAIL),FILTER_VALIDATE_EMAIL))? true : false ;
}
Granted, this isn't bulletproof (but then again, it isn't meant to be). It's just a much less tightfisted version (more relaxed). But if you need ultra strict email validation, then by all means, the link I provided above would do nicely.
If you're interested in learning PCRE, below are some resources to help get you started in learning preg:
Regular Expressions
WeblogToolsCollection
Mastering Regular Expressions
PhpFreaks Resources
PHPFreaks Tutorial