ddliu/requery

Query text data with the power of Regular Expression.

v0.1.1 2014-12-17 11:10 UTC

This package is auto-updated.

Last update: 2024-12-13 23:01:09 UTC


README

Query text data with the power of Regular Expression.

Usage

use ddliu\requer\Context;

$q = new Context($content);
$q->find('#<table>.*</table>#Uis')
    ->then(function($table) {
        $table->findAll('#<th>(.*)</th>#Uis')
            ->each(function($th) {
                echo 'th: '.$th[1]."\n";
            });
    })
    ->then(function($table) {
        $table->find('#<tbody>.*</tbody>#Uis')->findAll('#<tr>.*</tr>#Uis')
            ->each(function($tr) {
                $tr->findAll('#<td>(.*)</td>#Uis')
                    ->each(function($td) {
                        echo 'td: '.$td[1]."\n";
                    });
            });
    });