#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171

    Is it possible to detect if text contains email or phone number?


    I highly doubt this would be possible but;

    Is there anyways to detect the following numbers and emails in such strings?
    PHP Code:
    $string "This is some random text, Lispsun
    0 4 2 4 0 333 2 2 2.
    0-4-2-4-3-3-3-3-3-2.
    O for to for tree tree tree six for nine
    I can also have some email address like 
    myemailATgmailDOTCOM
    myemail @ gmail.com
    .
    .
    .
    "

    Thanks
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,066
    Rep Power
    9398
    Considering how there's one definitive way to tell whether a particular part of a string is an email address or a phone number (presence of a @) then yes: regular expressions. Run one that can find email addresses and another that can find phone numbers against your text.

IMN logo majestic logo threadwatch logo seochat tools logo