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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,390
  • 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

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,361
  • I don't really come from outer space
    • 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
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.