0
$regex = array(
                "`^([\t\s]+)`ism"=>'',
                "`^\/\*(.+?)\*\/`ism"=>"",
                "`([\n\A;]+)\/\*(.+?)\*\/`ism"=>"$1",
                "`([\n\A;\s]+)//(.+?)[\n\r]`ism"=>"$1\n",
                "`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism"=>"\n"
            );
$file_content = preg_replace(array_keys($regex), $regex, $file_content);

I received this warning:

preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 4

Dharman
  • 30,962
  • 25
  • 85
  • 135
Meir Levi
  • 19
  • 6

1 Answers1

0

The reason is \A inside square brackets.

Here is a good answer about the reason in general.

PHP PCRE engine migrates to PCRE2

PCRE2 is more strict in the pattern validations, so after the upgrade, some of your existing patterns could not compile anymore.

Konstantin Bogomolov
  • 1,278
  • 1
  • 11
  • 16