HI Guys why doesnt this reg.exp work ? The 'TEST' should be replaced with XXX ?
<?php
$Rules = array ('@<script[^>]*?>.*?</script>@si',
'@(TEST);+@e');
$Replace = array ('',
'XXX'
);
$data ="this is a TEST string";
$data = preg_replace($Rules, $Replace,$data);
echo $data;
?>
Your regex is (TEST);+
which matches the lister string TEST
followed by one or more of +
.
Since there are no ;
in your string $data
, the match never happens.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.