Created
March 12, 2013 08:06
-
-
Save narita1980/5141046 to your computer and use it in GitHub Desktop.
HTMLファイル内のimgタグを抽出する ■使用例
$ php exp_imgtag.php < sample.html
<img alt="・・・・ />
<img border="・・・ />
・・・
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$stdin = file_get_contents('php://stdin', 'rb'); | |
preg_match_all('@<img .*?/>@isu' ,$stdin ,$regex, PREG_SET_ORDER); | |
foreach ($regex as $str) { | |
echo $str[0] . PHP_EOL; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment