这个正则表达式是正确的(eregi到preg_match转换)[重复]

This question already has an answer here:

I am replacing PHP deprecated functions in my website. I have this code:

(eregi("<[^>]*object.*\"?[^>]*>", $secvalue))

It is written on the php.net site that it eregi should be replaced with preg_match with i modifier.

Is this coded right?

(preg_match("<[^>]*object.*\"?[^>]*/i>", $secvalue))

or should I place /i somewhere else?

</div>
preg_match('/<[^>]*object.*\"?[^>]*>/i', $secvalue)

You need to add a forward slash at the beginning to match the closing one:

 preg_match('/<[^>]object."?[^>]*>/i', $secvalue);