I am trying to figure the best way to check a string to see if it resembles an email address

In VB I use the condition> (have rem'd it out, don't know what code does in posted text, don't want to get into trouble!!)

'// If InStr(TheUrl, "@") > 1 Then
'// OpenEmail TheUrl, theEmailSubject, theEmailString
'// endif

Not the best test i am sure but it's the only sure way i've found of routing out things that are not email addresses, ie not everyone’s address end with .co.uk or .com or… I am sure you know what I mean.

New to php I have been trying to figure out something that would do the same job, any ‘tidy’ ideas anyone?

    If you want to use the exact same function as you already does you can use substr_count.

    However this does not check if it is a real e-mail, search this forum and google then you will find lots of email address validations. An example is here.

      5 days later

      thanks Piranha
      cool links, just the clues i was looking for.
      some good ideas there, however still getting confused with php and java and javascript.
      trying to keep things pure php for the moment (well a little html now and again)!
      may get back to this thread when i have further problems!
      cheers again though,
      = : )

        Write a Reply...