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,
    Im 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 Im not a programer and my site is with problems because of this.
    The little bit of code Im 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. #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. #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    4,611
    Thanks
    14
    Thanked 482 Times in 477 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

  4. Users who have thanked Dormilich for this post:

    mjardim (05-09-2014)

  5. #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!

  6. #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    453
    Thanks
    18
    Thanked 27 Times in 27 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.


 

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
  •