SoFunction
Updated on 2025-04-13

php regular

1  Modifier: It seems that it is not said
2  The matching pattern seems to be a little small
For example <?php
$cp = preg_replace( "@<script(.*?)</script>@is", "", $cp );
            $cp = preg_replace( "@<iframe(.*?)</iframe>@is", "", $cp );
            $cp = preg_replace( "@<style(.*?)</style>@is", "", $cp );
?> Appears "@<script(.*?)</script>@I am confused

Hope you get help, thank you

"@<script(.*?)</script>@

Non-greedy pattern means matching the first < after script, equivalent to @<script([^>]*)</script>@

Sometimes [^>]+? Get the exact match.