-1

We recently transferred our hosting and all of the sudden errors came up to our preg_match scripts.

$lines = explode("\n",$email); //Email message by email forwarding    

if(preg_match("/^(.*)/ GMT(.*)/       <reply@pipe.mydomain.com>:/",$lines[$i],$matches)){
                    $message .= str_replace($matches[1],"",$lines[$i]);
                }

It returns unknown modifier 'G' after removing G, it shows unknown modifier 'M' error.

Also tried preg_match_all() still same error shows up.

user1528706
  • 131
  • 2
  • 13
  • don't you need to escape `/` in the pattern?? – Andrew Jan 19 '16 at 01:21
  • Your error settings are probably different on the new server as well, you should adjust if this is production that so you aren't exposing credentials. – chris85 Jan 19 '16 at 01:35

1 Answers1

0

EScape the middle forward slashes or use different php delimiters.

"~^(.*)/ GMT(.*)/       <reply@pipe.mydomain.com>:~"

Use \h+ to match one or more horizontal spaces.

"~^(.*)/\h+GMT(.*)/\h+<reply@pipe.mydomain.com>:~"
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274