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

PHP regular example of taking image path

WBOY
Release: 2016-07-25 09:00:09
Original
1377 people have browsed it
  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



source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template