开发者

Is this regex right (eregi to preg_match conversion) [duplicate]

开发者 https://www.devze.com 2023-03-20 13:38 出处:网络
This question already has answers here: How can I convert ereg expressions to preg in PHP? (4 answers) Closed 3 years ago.
This question already has answers here: How can I convert ereg expressions to preg in PHP? (4 answers) Closed 3 years ago.

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?


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号