[\s\S]*?<\/a>)/',' ',$str);" Just remove the a tag."/> [\s\S]*?<\/a>)/',' ',$str);" Just remove the a tag.">
Home >Backend Development >PHP Problem >How to remove a tag in php regular expression
php regular method to remove a tag: first create a PHP sample file; then use the regular expression "preg_replace('/(
[\s\S]*?f371a58f3ef87676efa317bc10930c69)/','',$str);" Just remove the a tag. *?>
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php regular match all a tag, and delete the
Specific question:
The basic format is fa3fcf4408e3a2da0542159d10a6fbc1
I use /\c5de07a428a9dc07a88dc24f74619d71[\s\S]{0,}\ffdd5a1c987b4d0babd4a5f667981057/, this can only match from the beginning of f069800de5bef5f3867e98da1000a95c
Cannot match all a tags individually...
Implementation method:
Regular expression such as:
preg_replace('/(<a.*?>[\s\S]*?<\/a>)/','',$str);
Recommended learning: "PHP video tutorial》
The above is the detailed content of How to remove a tag in php regular expression. For more information, please follow other related articles on the PHP Chinese website!