Mega Code Archive

 
Categories / Php / Strings
 

Using preg functions

<?php if (preg_match('{<title>.+</title>}', $html)) {     // page has a title } if (preg_match_all('/<li>/', $html, $matches)) {     print 'Page has ' . count($matches[0]) . " list items\n"; } // turn bold into italic $italics = preg_replace('/(<\/?)b(>)/', '$1i$2', $bold); ?>