The matching rule cannot use "//i" because it cannot match newline characters, so multiple lines of js cannot be matched. Use "/.
Source code example:
Copy code The code is as follows:
php
header("Content-type:text/html;charset=utf-8");
$str = '
Test php regular matches the js code Test php regular matches the js code Test php regular matches the js code Test php regular matches the js code Test php regular matches the js code Test php regular matches the js code
Test the php regular match to match the js code';
$preg = "/