Home >Backend Development >PHP Tutorial >PHP regular example of taking image path

PHP regular example of taking image path

WBOY
WBOYOriginal
2016-07-25 09:00:091369browse
  1. /**

  2. *Regular image path
  3. * by http://bbs.it-home.org
  4. */
  5. $pattern="//";
  6. $str='

  7. ';

  8. preg_match_all($pattern,$str,$match);
  9. print_r($match);

  10. /*

  11. 1 (?s) represents Pattern.DOTALL, which is matching line breaks and is allowed in img Appears in multiple lines
  12. 2 .*? means non-greedy matching of any character until the following condition appears
  13. 3 ?: means this match but is not captured, that is, it does not appear in the result [.gif|.jpg] means or
  14. */
  15. ?>
Copy code

Now that we have mentioned PHP regular rules, you can refer to the previous article: php regular expression complete tutorial 6 php regular expression complete tutorial 5 php regular expression complete tutorial 4 php regular expression complete tutorial 3 php regular expression complete tutorial 2 php regular expression complete tutorial 1



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn