How to implement php regular matching that does not contain a certain character: first create a PHP sample file; then enter the statement "$search = '/<([^<]*?)>/is ';preg_match_all($search,$str,$r);"; Finally, execute the file.
Recommended: "PHP Video Tutorial"
php Regular matching content does not include A certain character
Specific question:
I need to match characters that include < >, but they cannot contain <
For example:
Hello customer, I recommend the following projects to you:
I want to match
Implementation method:
<?php $str = '客户您好,为您推荐以下项目:<项目2:项目名称<项目3:项目名称>>以及<项目1:项目名称>'; $search = '/<([^<]*?)>/is'; preg_match_all($search,$str,$r); echo '<pre class="brush:php;toolbar:false">'; print_r($r); echo ''; ?>
The above is the detailed content of How to implement PHP regular matching that does not contain a certain character. For more information, please follow other related articles on the PHP Chinese website!