Solution to the problem that php cannot match the regular pattern: 1. Use the preg_match_all() function to obtain the regular matching content; 2. Output the matching content through print_r.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
Specific questions:
php正则匹配不到 为什么我这个一个也匹配不到呢?
Solution:
1. To obtain the content matched by the regular expression, you should use the preg_match_all() function
2. It is an array. Arrays cannot be output using echo. If echo outputs an array, it will only display Array
. Recommended study: "PHP Video Tutorial"
The above is the detailed content of What should I do if the php regular expression cannot be matched?. For more information, please follow other related articles on the PHP Chinese website!