1

I'm pretty naff with regexpressions :( and I have inherited a bunch of code from a previous developer who has put lots of eregi_replace which are now deprecated on PHP 5.3

The functions in the code are:

eregi_replace("[\]","",$text);

I know I have to replace this function with preg_replace but I'm not sure what to do to "[]" in order to make it perl compatible.

I've tried "/[]/" but that gets a compilation error in PHP error log.

Many thanks

Daniel Procter
  • 188
  • 1
  • 2
  • 16

1 Answers1

2

Don't use eregi_replace, this function has been DEPRECATED as of PHP 5.3.0.
Relying on this feature is highly discouraged.


  str_replace() - Replace all occurrences of the search string with the replacement string
preg_replace() - Perform a regular expression search and replace


str_replace("\", "", $text);
Ωmega
  • 42,614
  • 34
  • 134
  • 203