RE: [PHP-WIN] checking for characters -- preg_match()

2002-04-10 Thread Matt Hillebrand
xplodes though Ross -Original Message- From: Matt Hillebrand [mailto:[EMAIL PROTECTED]] Sent: 10 April 2002 00:34 To: 'Egil Helland'; 'brother' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-WIN] checking for characters I like Egil's idea of readable code using e

RE: [PHP-WIN] checking for characters

2002-04-10 Thread Svensson, B.A.T. (HKG)
> Don't forget about the new .name, and I thought I might mention that > preg()/PCREs would be the way to go if you're trying to make your code > readable. That's why we have the remark statement (e.g. to make unclear code more readable). It is always a good habit to frequently comment your code

RE: [PHP-WIN] checking for characters

2002-04-10 Thread Ross Fleming
what's wrong with ereg and care to give perl related code?... -Original Message- From: Matt Hillebrand [mailto:[EMAIL PROTECTED]] Sent: 10 April 2002 01:53 To: [EMAIL PROTECTED]; 'Egil Helland'; 'brother' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-WIN] checking for

RE: [PHP-WIN] checking for characters

2002-04-09 Thread Matt Hillebrand
ing like that. I'd personally use a couple of explodes though Ross -Original Message- From: Matt Hillebrand [mailto:[EMAIL PROTECTED]] Sent: 10 April 2002 00:34 To: 'Egil Helland'; 'brother' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-WIN] checking for characters

RE: [PHP-WIN] checking for characters

2002-04-09 Thread Ross Fleming
; Cc: [EMAIL PROTECTED] Subject: RE: [PHP-WIN] checking for characters This was posted to the same group ages ago: if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)$" ,$email)) { //email address is valid } else { // it ain't } Or something like

RE: [PHP-WIN] checking for characters

2002-04-09 Thread Ross Fleming
Original Message- From: Matt Hillebrand [mailto:[EMAIL PROTECTED]] Sent: 10 April 2002 00:34 To: 'Egil Helland'; 'brother' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-WIN] checking for characters I like Egil's idea of readable code using explode and regular express

RE: [PHP-WIN] checking for characters

2002-04-09 Thread Matt Hillebrand
I like Egil's idea of readable code using explode and regular expressions. Or, you could use this function I wrote: function isValidEmail($email) { if(strlen($email) < 6) return false; $at = -1; // index of '@' for($i=0; $i$at && $imailto:[EMAIL PROTECTED]] Brush up on your patt

Re: [PHP-WIN] checking for characters

2002-04-09 Thread Egil Helland
Brush up on your patternmatching then, brother. Check the php.net manual on regexp. If you want more readable code, try splitting the string (explode) on @ first, then split the segment after @ that you now have on . again. Cheers, Egil (in Norway, so I am way past bedtime myself :)) On Wed