Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/hxseven/htmlSQL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas John <jonas@jonasjohn.de>2012-02-09 13:42:59 +0400
committerJonas John <jonas@jonasjohn.de>2012-02-09 13:42:59 +0400
commita44eee9e97a7851596e26de2c9e53fa569df7389 (patch)
tree27904364de31aad4ddfab8bc006261fc6a382382 /examples
Initial commit (version 0.5 of May 2006)
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/demo_01.php46
-rwxr-xr-xexamples/demo_02.php38
-rwxr-xr-xexamples/demo_03.php37
-rwxr-xr-xexamples/demo_04.php36
-rwxr-xr-xexamples/demo_05.php38
-rwxr-xr-xexamples/demo_06.php40
-rwxr-xr-xexamples/demo_07.php37
-rwxr-xr-xexamples/demo_08.php86
-rwxr-xr-xexamples/demo_09.php51
-rwxr-xr-xexamples/demo_10.php55
-rwxr-xr-xexamples/demo_11.php36
-rwxr-xr-xexamples/demo_12.php44
-rwxr-xr-xexamples/demo_data.htm195
-rwxr-xr-xexamples/demo_xml.xml8
-rwxr-xr-xexamples/query_examples.txt51
15 files changed, 798 insertions, 0 deletions
diff --git a/examples/demo_01.php b/examples/demo_01.php
new file mode 100755
index 0000000..a168b82
--- /dev/null
+++ b/examples/demo_01.php
@@ -0,0 +1,46 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 1
+ **
+ ** Shows a simple query
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query extracts all links with the classname = nav_item
+ */
+ if (!$wsql->query('SELECT * FROM a WHERE $class == "nav_item"')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // show results:
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ /*
+ $row is an array and looks like this:
+ Array (
+ [href] => /feedback.htm
+ [class] => nav_item
+ [tagname] => a
+ [text] => Feedback
+ )
+ */
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_02.php b/examples/demo_02.php
new file mode 100755
index 0000000..b660af1
--- /dev/null
+++ b/examples/demo_02.php
@@ -0,0 +1,38 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 2
+ **
+ ** Shows a simple query and the "href as url" usage
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a file
+ if (!$wsql->connect('file', 'demo_data.htm')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query extracts all links from the document
+ and just returns href (as url) and text
+ */
+ if (!$wsql->query('SELECT href as url, text FROM a')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // show results:
+ foreach($wsql->fetch_array() as $row){
+
+ print "Link-URL: " . $row['url'] . "\n";
+ print "Link-Text: " . trim($row['text']) . "\n\n";
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_03.php b/examples/demo_03.php
new file mode 100755
index 0000000..dc05e19
--- /dev/null
+++ b/examples/demo_03.php
@@ -0,0 +1,37 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 3
+ **
+ ** Shows how to connect to a file and a simple query
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a file
+ if (!$wsql->connect('file', 'demo_data.htm')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query searches in all tags for the id == header and returns
+ the tag
+ */
+ if (!$wsql->query('SELECT * FROM * WHERE $id == "header"')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // show results:
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_04.php b/examples/demo_04.php
new file mode 100755
index 0000000..5f7df78
--- /dev/null
+++ b/examples/demo_04.php
@@ -0,0 +1,36 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 4
+ **
+ ** Shows a advanced query with preg_match
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/links.htm')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns all links of an document that start with http://
+ */
+ if (!$wsql->query('SELECT * FROM a WHERE preg_match("/^http:\/\//", $href)')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // show results:
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_05.php b/examples/demo_05.php
new file mode 100755
index 0000000..48ea46f
--- /dev/null
+++ b/examples/demo_05.php
@@ -0,0 +1,38 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 5
+ **
+ ** Shows a advanced query (with substr)
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/links.htm')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns all links of an document that not start with /
+ ( / = internal links)
+ */
+ if (!$wsql->query('SELECT * FROM a WHERE substr($href,0,1) != "/"')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as object and format as HTML links:
+ foreach($wsql->fetch_objects() as $obj){
+
+ print '<a href="'.$obj->href.'">'.$obj->text.'</a><br/>';
+ print "\n";
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_06.php b/examples/demo_06.php
new file mode 100755
index 0000000..0e2a2c2
--- /dev/null
+++ b/examples/demo_06.php
@@ -0,0 +1,40 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 6
+ **
+ ** Show how to connect to a string
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+
+ $some_html = '<a href="link1.htm">link1</a> <b>foobar</b> ';
+ $some_html .= '<a href="link2.htm">link2</a> <hr/>';
+
+ $wsql = new htmlsql();
+
+ // connect to a string
+ if (!$wsql->connect('string', $some_html)){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns all links of the given HTML
+ */
+ if (!$wsql->query('SELECT * FROM a')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array and output them:
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_07.php b/examples/demo_07.php
new file mode 100755
index 0000000..f293cb9
--- /dev/null
+++ b/examples/demo_07.php
@@ -0,0 +1,37 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 7
+ **
+ ** Shows a complex query
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/browse/lang/php/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query searches all links where the URL starts with /snippets and the text starts with
+ "array_" => so all links to array functions will be returned
+ */
+ if (!$wsql->query('SELECT * FROM a WHERE preg_match("/^\/snippets/i", $href) and preg_match("/^array_/i", $text)')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array return them:
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_08.php b/examples/demo_08.php
new file mode 100755
index 0000000..e25a009
--- /dev/null
+++ b/examples/demo_08.php
@@ -0,0 +1,86 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 8
+ **
+ ** Shows how to parse a RSS/XML file with htmlSQL
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to the RSS URL (this URL contains new snippets from my codedump project)
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/rss/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ select the text attribute (alias for the tag content) from the <item> tag
+ */
+ if (!$wsql->query('SELECT text FROM item')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch all results as objects:
+ foreach($wsql->fetch_objects() as $obj){
+
+ // create a new htmlsql object:
+ $sub_wsql = new htmlsql();
+
+ // connect to the <item> content:
+ $sub_wsql->connect('string', $obj->text);
+
+ // fetch all attributes of all tags:
+ if (!$sub_wsql->query('SELECT * FROM *')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // this "special" function converts tagnames to keys
+ $sub_wsql->convert_tagname_to_key();
+
+ /* this function converts an array that looks like this:
+
+ $array[0]['tagname'] = 'title';
+ $array[0]['text'] = 'example 1';
+
+ $array[1]['tagname'] = 'link';
+ $array[1]['text'] = 'http://www.example.org/';
+
+ $array[2]['tagname'] = 'description';
+ $array[2]['text'] = 'description bla';
+ $array[2]['fulltext'] = '1'; // additional attribute
+
+ -> to:
+
+ $array['title']['text'] = 'example 1';
+
+ $array[1]['link']['text'] = 'http://www.example.org/';
+
+ $array[2]['description']['text'] = 'description bla';
+ $array[2]['description']['fulltext'] = '1'; // additional attribute
+
+ this makes the array easier to access
+
+ */
+
+
+ // fetch item as array:
+ $item = $sub_wsql->fetch_array();
+
+ // format the extracted links as HTML links and output them:
+ print "<a href=\"" . $item['link']['text'] . "\">";
+ print $item['title']['text'] . "</a><br/>\n";
+
+ // also available:
+ // description, pubDate
+
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_09.php b/examples/demo_09.php
new file mode 100755
index 0000000..25fc23e
--- /dev/null
+++ b/examples/demo_09.php
@@ -0,0 +1,51 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 9
+ **
+ ** Shows how to use the "select" function
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ // restricts the search process to the content between
+ // <body> and </body>
+ // this also works with other tags like: head or html, or table
+ $wsql->select('body');
+
+ /*
+ other examples:
+
+ $wsql->select('div',3); <-- selects the third <div>
+
+ $wsql->select('table',0); <-- selects the first table
+ ^ default is also = 0
+ */
+
+
+ /* execute a query:
+
+ This query returns all <h1> headers
+ */
+ if (!$wsql->query('SELECT * FROM h1')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_10.php b/examples/demo_10.php
new file mode 100755
index 0000000..961a0a8
--- /dev/null
+++ b/examples/demo_10.php
@@ -0,0 +1,55 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 10
+ **
+ ** Shows how to use the "isolate_content" function
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /*
+ ** The isolate_content functions works like the select function,
+ ** but you can specify custom HTML parts, the content between
+ ** these two strings will be used for the query process
+ **
+ ** In this case we select all content between "<h1>New snippets</h1>"
+ ** and "<p id="rss">" this returns all snippet links, and no other links
+ ** (like header or navigation links)
+ */
+
+ $wsql->isolate_content('<h1>New snippets</h1>', '<p id="rss">');
+
+ /*
+ other examples:
+
+ $wsql->isolate_content('<body>', '</body>');
+ $wsql->isolate_content('<!--content:start-->', '<!--end-->');
+ */
+
+ /* execute a query:
+
+ This query returns all links:
+ */
+ if (!$wsql->query('SELECT * FROM a')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_11.php b/examples/demo_11.php
new file mode 100755
index 0000000..591598f
--- /dev/null
+++ b/examples/demo_11.php
@@ -0,0 +1,36 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 11
+ **
+ ** Shows how to query a simple XML file
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // connect to the demo XML file:
+ if (!$wsql->connect('file', 'demo_xml.xml')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns the id, name and password of all active users
+ */
+ if (!$wsql->query('SELECT id, name, password FROM user WHERE $status == "active"')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_12.php b/examples/demo_12.php
new file mode 100755
index 0000000..68d524a
--- /dev/null
+++ b/examples/demo_12.php
@@ -0,0 +1,44 @@
+<?php
+
+ /*
+ ** htmlSQL - Example 12
+ **
+ ** Shows how to replace the user agent and the referer with
+ ** custom values
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // set a individual agent:
+ $wsql->set_user_agent('MyAgentName/0.9');
+
+ // set a new referer:
+ $wsql->set_referer('http://www.jonasjohn.de/custom/referer/');
+
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns all links:
+ */
+ if (!$wsql->query('SELECT * FROM a')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?> \ No newline at end of file
diff --git a/examples/demo_data.htm b/examples/demo_data.htm
new file mode 100755
index 0000000..bd5d766
--- /dev/null
+++ b/examples/demo_data.htm
@@ -0,0 +1,195 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ this is a modified HTML source code from www.jonasjohn.de
+ for htmlSQL - testing purposes only
+
+ Copyright (c) 2004-2006 Jonas John
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>jonasjohn.de: startpage</title>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Language" content="en" />
+
+ <meta name="description" content="Personal WebSite of Jonas John." />
+ <meta name="keywords" content="jonas, john, photos, design, php, tests, experiments, privat, portfolio" />
+
+ <meta name="MSSmartTagsPreventParsing" content="true" />
+ <meta http-equiv="imagetoolbar" content="no" />
+
+
+ </head>
+<body>
+
+<p class="hidden">
+ <a href="#content" accesskey="s">Skip to content...</a>
+</p>
+
+<div id="nav">
+ <div id="inner_nav">
+
+ <a href="http://www.jonasjohn.de/" id="logo" accesskey="h">
+ <img src="/img/logo.png" width="137" height="30" alt="jonasjohn.de - logo" />
+ </a>
+
+ <div id="lang">
+ <span class="hidden">Choose your language:</span>
+ <a href="/" accesskey="e" id="lang_sel"><img src="/img/l_eng.png" alt="" width="27" height="20" /> english</a>
+ <a href="/de/" id="lang_def" accesskey="d"><img src="/img/l_de.png" alt="" width="27" height="20" /> deutsch</a>
+ </div>
+
+ <br class="clear" />
+
+ <div id="info_panel"></div>
+
+ </div>
+</div>
+
+
+<div id="header">
+ <div id="inner_header">
+
+ <span class="hidden">Navigation:</span>
+ <ul>
+ <li><a href="/" accesskey="1">Home</a></li>
+ <li><a href="/lab/" accesskey="2">Lab</a></li>
+ <li><a href="/pictures/" accesskey="3">Photos</a></li>
+ <li><a href="/about/" accesskey="4">About me</a></li>
+ <li><a href="/sitemap.htm" accesskey="5">Sitemap</a></li>
+ <li><a href="/contact.htm" accesskey="6">Contact</a></li>
+ </ul>
+
+ <br class="clear" />
+ </div>
+</div>
+
+<div id="page">
+ <div id="inner_page">
+
+ <a name="content"></a>
+
+ <div id="h_left">
+
+ <h1 class="big">
+ &#172; welcome to...<br/>
+ <span class="sub">the personal website of jonas john!</span>
+ </h1>
+
+ <p>
+
+ Hello and welcome to the personal website of <b>Jonas John</b>. This is my personal
+ web playground, I use it to present myself and to create some experimental
+ things. Have fun!
+
+
+ <br/>
+ <br/>
+ <br/>
+
+ </p>
+ </div>
+
+ <div id="h_right">
+ <p>
+ <b>News (May 04, 2006):</b><br/>
+ I published the third version of my website. Now it's almost
+ completely translated in English. Just a few texts left.
+ <br/>
+ <br/>
+
+ <a href="/news.htm" id="more">News archive...</a>
+ <br/>
+ </p>
+
+ </div>
+
+ <br class="clear" />
+
+ <div id="inner_content" class="clear sect_spacer">
+
+ <div class="large_box">
+
+ <h2>What do I find here?</h2>
+
+ <div class="halfbox bleft">
+ <p>
+ <a href="/lab/">
+ <img src="img/p_code.png" alt="my lab" width="120" height="90" /><br/><span class="plink">Lab</span>
+ </a>
+
+ Look on this page to get some informations about my
+ <b>web projects</b> and software that I made.
+
+ </p>
+ </div>
+
+ <div class="halfbox bright">
+ <p>
+ <a href="/pictures/">
+ <img src="img/p_photo.png" alt="photos" class="img_left" width="120" height="90" /><br/><span class="plink">Photos</span>
+ </a>
+
+ Here you find a few <b>photos</b> I made. I'm an amateur photographer,
+ so don't expect too much ;-)
+
+ </p>
+ </div>
+
+ <br class="clear" />
+ <br class="clear boxspacer" />
+
+ <div class="halfbox bleft">
+ <p>
+ <a href="/lab/adblock.htm">
+ <img src="img/p_adblock.png" alt="adblock filterset generator" class="img_left" width="120" height="90" /><br/><span class="plink">Adblock F. Generator</span>
+ </a>
+
+ This <b>Adblock Plus Filterset Generator</b> allows you to create your own customized
+ filterlist for the Firefox Plugin &quot;Adblock Plus&quot;. Just check or uncheck
+ the filters you want.
+
+
+ </p>
+ </div>
+
+ <div class="halfbox bright">
+ <p>
+ <a href="/lab/codedump.htm">
+ <img src="img/p_codedump.png" alt="codedump" class="img_left" width="120" height="90" /><br/><span class="plink">Codedump</span>
+ </a>
+
+ Here you can find around 70 <b>code snippets</b> for different topics.
+ The snippet languages are PHP, JavaScript, HTML, Perl and Python.
+ You can use them freely in your projects (public domain).
+
+ </p>
+ </div>
+
+ <br class="clear" />
+ <br/>
+ </div>
+
+ <br/>
+
+ <br class="clear" />
+
+ </div>
+
+ </div>
+
+</div>
+
+<div id="footer">
+ <p>
+ Copyright &copy; 2004-2006 Jonas David John. All rights reserved.
+ <a href="/contact.htm">Imprint</a>
+ </p>
+</div>
+
+</body>
+</html>
+
diff --git a/examples/demo_xml.xml b/examples/demo_xml.xml
new file mode 100755
index 0000000..e54968e
--- /dev/null
+++ b/examples/demo_xml.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<users>
+ <user id="0" name="admin" password="foobar" status="active"></user>
+ <user id="1" name="jonas" password="heyho" status="active"></user>
+ <user id="2" name="jack" password="daniels" status="drunk"></user>
+ <user id="3" name="bill" password="kill" status="dead"></user>
+ <user id="4" name="homer" password="kenny" status="active"></user>
+</users> \ No newline at end of file
diff --git a/examples/query_examples.txt b/examples/query_examples.txt
new file mode 100755
index 0000000..638bd6c
--- /dev/null
+++ b/examples/query_examples.txt
@@ -0,0 +1,51 @@
+
+Some query examples for copy & paste ;-)
+
+
+SELECT * FROM h1
+^ select all <h1> tags
+
+
+SELECT * FROM a
+^ select all links
+
+
+SELECT * FROM td
+^ select all <td>'s
+
+
+SELECT href as url, text FROM a
+^ return href as url and text as text from all links
+
+
+SELECT * FROM a WHERE preg_match("/^http:\/\//", $href)
+^ find all external links
+
+
+SELECT * FROM a WHERE preg_match("/^\/snippets/i", $href) and preg_match("/^array_/i", $text)
+^ find all links starting with /snippets and with a link text starting with "array_"
+
+
+SELECT * FROM *
+^ select all attributes of all tags ;-)
+
+
+SELECT id, name, password FROM user WHERE $status == "active"
+^ select all <user> tags where status="active" (for XML files)
+
+
+SELECT * FROM * WHERE $id == "header"
+^ return all tags with the $id = header
+
+
+SELECT * FROM a WHERE substr($href,0,1) != "/"
+^ select links with URLs that start with / (mainly internal links)
+
+
+SELECT * FROM * WHERE $class == "nav_item"
+^ select all tags with the class = nav_item
+
+
+SELECT * FROM a WHERE ($href == "foo.htm" and $title == "foo") or ($title == "bar")
+^ complex query
+