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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Help in ereg_replace

    Hello community,
    I’m in need of help here, hope I can count on you my friends

    After Hostgator made an PHP upgrade, the ereg_replace stopped working, it has been discontinued.
    I now have a problem at hands because I’m not a programer and my site is with problems because of this.
    The little bit of code I’m in need of help is this one:

    $pattern="[?() \/&#\,\;\.$@+]";
    $valid_file=ereg_replace($pattern,”_”,trim($fname));


    How can I overcome this situation, so this could work again?

    Thanks in advance for any help,
    Regards,
    Marco

  • #2
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Just an update:
    I’ve also tried preg_replace but had no luck, I think I’m not doing it right, so any help would be appreciated.
    Thanks once more,
    Regards,
    Marco

  • #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,280
    Thanks
    12
    Thanked 343 Times in 339 Posts
    for your purpose str_replace() would work as well.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • Users who have thanked Dormilich for this post:

    mjardim (05-09-2014)

  • #4
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Hello my friend, thanks for your help, it solved the problem.
    It now works and all is good
    Thank you once more for your trouble and help.
    Rock On!

  • #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    416
    Thanks
    18
    Thanked 26 Times in 26 Posts
    Just for next time, If you want to use preg_replace, you were imply missing the characters around the pattern. Padding both sides with a forward slash would have fixed that.
    If I've helped you out, show your appreciation by clicking the "Thanks" link as well as a link below!

    AdFly
    Facebook | Twitter
    Google | YouTube


  •  

    Tags for this Thread

    Posting Permissions

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