Mega Code Archive

 
Categories / Php / Strings
 

M modifier

The anchor patterns ^ and $ match the beginning and end of an entire string by default.  <? $text = "name: Joe\noccupation: coder\n\n"; if ( preg_match_all( "/^\w+:\s+(.*)$/m", $text, $array ) ) {   print "<pre>\n";   print_r( $array );   print "</pre>\n"; } ?>