Mega Code Archive

 
Categories / Php / Strings
 

Matching with

<?php $text = "The files are c.gif, r.pdf, and e.jpg."; if (preg_match_all('/[a-zA-Z0-9]+\.(gif|jpe?g)/',$text,$matches)) {     print "The image files are: " . implode(',',$matches[0]); } ?>