0

I have deprecated "eregi" problem.

if (eregi("data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)", $edit_img, $tmp))

So I changed into this,

if (preg_match("/data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)/i", $edit_img,$tmp))

But I got new warmingmessage,

Warning: preg_match() [function.preg-match]: Unknown modifier 'c' 

Please let me know what is wrong.

Thanks in advance.

DIF
  • 2,470
  • 6
  • 35
  • 49
WindStory
  • 19
  • 6
  • Possible duplicate of [How can I convert ereg expressions to preg in PHP?](https://stackoverflow.com/questions/6270004/how-can-i-convert-ereg-expressions-to-preg-in-php) – Toto Jun 03 '19 at 10:47

1 Answers1

3

You have a '/' inside your regex ('data/cheditor') but you are also using '/' as the regex delimiter ('/myregex/flags'): you can either escape the internal '/', or use a different regex delimiter.

E.g. first option:

preg_match('/data\/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)/i',...

or (second option, I chose '@' as the delimiter):

preg_match('@data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)@i',...

Also note I changed the " around your regex to ' because otherwise you need to double the backslashes within double-quotes in PHP.

mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194