Warning: preg_match(): Unknown modifier '['

They have: 426 posts

Joined: Feb 2005

I am trying to port eregi over to preg_match yet I keep getting the error?

preg_match($match = '/^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$/', $headers[0], $matches)

Any help appreciated.

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

You need to escape the / but if you change the delimiter to a hash, then you won't need to:

#^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$#

That regex doesn't look right anyway. What are you trying to match?

They have: 426 posts

Joined: Feb 2005

My server does not have cURL installed, this is just part of an HTTP class that does the same job as cURL. because eregi has been deprecated I had to convert it to preg_match.
Why doesnt it look right?

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Well, I think it matches this: http/1\\2 3 $

I can't imagine that is what you want! Can you post your egregi regex?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.