Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2006
    Location
    Newcastle, england.
    Posts
    38
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Remove part of a string using // as a delimiter

    Hi,

    I have some email addresses being imported into a PHP script I'm working on, I need to get them from this form;

    mark hankins<markhankins@example.com>

    to this format;

    markhankins@example.com

    So far I have managed to remove a lot of the junk characters using str_replace, but now I'm left with addresses still with an alias, but separated by \name\email@address.com.

    If only I could get rid of the slashes and the bit between them I'd be sorted.

    Any advice? (Please be gentle, I'm a noob!)

    Thanks in advance.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    PHP Code:
    $mail 'mark hankins<markhankins@example.com>';
    $mail preg_replace("/^[^<]+<([^>]+)>$/","$1",$mail);
    echo 
    $mail."<br>"
    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •