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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post

    Regular Exp help

    How would I take everything from an email after the @ and write it to the end of line?

    ammil@rockafella.com and change it to ammil@rockafella.comrockafella.com

    all help is appreciated. Thanks.
    I would rather be a lion for a day than a lamb that lives forever.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You don't need a RegExp to do that:

    PHP Code:
    $str 'ammil@rockafella.com'
    $strArray explode('@'$str);

    echo 
    $str $strArray[1]; 
    But if you really want to, you can do that with RegExp:

    PHP Code:
    echo preg_replace('/@(.+)$/i''@\\\\1\\\\1'$str); 

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

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