File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/match.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/match.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/match.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 512 bytes
 

Contents

Class file image Download
<?php

$s
= 'blah<a href="a.php">blah</a><a href="b.php">blah</a>';
if (
preg_match('/<a\s+[^>]*href="[^"]+"/i', $s, $matches)) {
    print
"match: $matches[0]\n";
}
if (
preg_match('/<a\s+[^>]*href="([^"]+)"/i', $s, $matches)) {
    print
"match: $matches[1]\n";
}
if (
preg_match('/<a\s+[^>]*href="([^"]+)"/i', $s, $matches, PREG_OFFSET_CAPTURE)) {
    print
"match: ";
   
print_r($matches);
}

if (
preg_match_all('/<a\s+[^>]*href="([^"]+)"/i', $s, $matches)) {
    print
"match: ";
   
print_r($matches);
}

?>

For more information send a message to info at phpclasses dot org.