Author Topic: quick eregi_replace to preg_replace question  (Read 243 times)

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
quick eregi_replace to preg_replace question
« on: November 27, 2017, 11:35:38 AM »
since eregi _replace is deprecated, I need to convert to preg_replace.... but I'm not sure I fully understand the original code

So, help is requested form someone who groks php on a more than "hack it up" level...

How would I convert this (below) to a preg_replace?

eregi_replace('([[:punct:]])', '', $_POST['user'])

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,083
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: quick eregi_replace to preg_replace question
« Reply #1 on: November 27, 2017, 11:44:30 AM »
Try the following:

preg_replace('/([[:punct:]])/i', '', $_POST['user'])

hahah the wiki thing doesn't let me post the punct regex
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.