<?php

// $Id: regex.txt,v 1.10 2019/12/13 08:08:07 dgoron Exp $

// short documentation about the most used expressions

$content = "
<table border='0' width='100%'>
<tr>
<td align='left'>
<b>PMB: Boolean expressions</b>
</td>
<td align='right'>
<a href='#' onclick='window.close()'>
<!--<img src='./images/close.gif' border='0' alt='[$msg[197]]' title='$msg[197]'>-->
[$msg[197]]
</a>
</td>
</tr>
</table>
<hr />
<b>Simple search</b>
<p class='pn-normal'>By default, the engine looks for records containing <b>at least</b> (!!operator_uppercase!! implicit) one of the words entered. The result is sorted by the number of word hits in descending order and then alphabetically.
<br />E.g. <em>cheddar cheese</em> means records containing the words <em>cheddar</em> <b>!!operator_uppercase!!</b> <em>cheese (Cheddar cheese, Red Leicester cheese, The history of the Cheddar region, ...)</em>.
<br />Accented characters are ignored, uppercase words as well. If two words are separated by another sign other than space, +, or -, both words are regarded as having to figure in the search result <br />E.g. <em>Cheddar cheese/Australia</em> will be analysed as : find records containing <em>cheddar</em> <b>OR</b> records containing <em>cheese</em> <b>AND</b> <em>australia</em> <b>OR</b> both.
<br />Some words are ignored because too frequent or having no significant meaning in English (e.g. : a, if, in, of, on, the, that, to, ...). They are referred to as stop words.</p>
<b>Compound words</b>
<p class='pn-normal'>The dash is regarded as an operator when placed between two words (see the section logical operators between two words). Hence, any compound word with a dash must be enclosed in quotation marks to make an exact term search (see further down the section Search exact terms).</p>
<b>Truncation</b>
<p class='pn-normal'>Words can be truncated to the left, right or partially using the sign *
<br />E.g. <em>hor*</em> would find the words starting with <em>hor</em> <em>(horse, horticulture, horror, ...)</em>, <em>*logy</em> would find the words ending with <em>logy</em> <em>(psychology, theology, trilogy, ...)</em>, <em>p*logy</em> would find the words starting with <em>p</em> and finishing with <em>logy</em> <em>(psychology, paleonthology, pathology, ...)</em>.
<br />Several truncations can be used within one and same word.</p>
<b>Searching exact terms</b>
<p class='pn-normal'>An exact term is defined as a text enclosed in quotation marks. If the search engine encounters an exact term, it looks up occurences of the exact wording of the term. Truncation may be used within exact terms.
<br />E.g. <em>''dent''</em> means all records containing the text dent (dentist, accident, indentation, ...).<br />
<br />Exact terms searching is very useful for search expressions containing spaces or punctuation marks (an acronym for example).
<br />E.g. <em>''R.N.L.I.''</em> would find records containing the text R.N.L.I., <em>R.N.L.I.</em> would find records containing the words R or N or L or I.<br />
<br />Accents and uppercase are ignored in an exact term. Finally, exact terms can be used in all complex expressions as in the examples described further below.
</p>
<b>Negation</b>
<p class='pn-normal'>The sign ~ placed before a word represents a negation of that term. It actually means search all records not containing that term at all.
<br />E.g. <em>~party</em> means find all records except those containing the word <em>party</em>.
</p>
<b>Logical operators in-between two words</b>
<p class='pn-normal'>Logical operators may be used in-between words :</p>
<ul><li><b>+</b> : operator !!operator_more_uppercase!!<br />E.g. <em>disk + hard</em> means all records containing the words <em>disk</em> <b>!!operator_more_uppercase!!</b> <em>hard</em>.</li><br />
<li><b>-</b> : operator NOT<br />E.g. <em>disk - hard</em> means all records containing the word <em>disk</em>, <b>but not those containing also </b> the word <em>hard</em>.</li>
</ul>
<p class='pn-normal'>Several operators may be chained together in one and same equation or search expression. The precedence order applied is from left to right.
<br />E.g. <em>poetry + french - romant*</em> means all records containing <em>poetry</em> <b>!!operator_more_uppercase!!</b> <em>french</em> <b>NOT</b> <em>romantic</em>.
<br /><br />Be careful, two operators cannot be placed immediately one after another, a negation cannot be combined with another operator (<b>+~</b> expresses the same thing as the operator <b>-</b>).
</p>
<b>Groupings</b>
<p class='pn-normal'>A search expression may be grouped so as to become a single term. Groupings are made using <b>parentheses</b>. They allow to change the order of precedence in the application of operators or to combine the results of complex search expressions or equations.
<br />E.g.</p>
<ul>
<li><em>poetry + (french romantic)</em> means in all records containing the words <em>french</em> !!operator_uppercase!! <em>romantic</em>, only those containing the word <em>poetry</em>.</li>
<li><em>(poetry + french) romantic</em> means all records containing <em>poetry</em> <b>!!operator_more_uppercase!!</b> <em>french</em> <b>!!operator_uppercase!!</b> all records containing the word <em>romantic</em></li>
<li><em>~(poetry + french) + (literature ameri*)</em> means all records <b>NOT containing the words</b> <em>poetry</em> !!operator_more_uppercase!! <em>french</em> <b>!!operator_more_uppercase!!</b> records containing the words <em>literature</em> <b>!!operator_uppercase!!</b> <em>ameri*</em></li>
</ul>
<p class='pn-normal'>Parentheses can be imbricated with one another endlessly.<br />E.g. <em>(poetry + (french romantic)) (literature + XIX)</em> means in all records containing <em>french</em> <b>!!operator_uppercase!!</b> <em>romantic</em>, <b>only those containing</b> <em>poetry</em> <b>OR records containing</b> <em>literature</em> <b>!!operator_more_uppercase!!</b> <em>XIX</em> 
</p>
<b>Relevance</b>
<p class='pn-normal'>Results are sorted by relevance and then alphabetically. Relevance is computed simply on the total number of words or exact terms hits.
<br />E.g.</p>
<ul>
<li><em>french poetry</em> will recall all records containing <em>french</em> <b>!!operator_uppercase!!</b> <em>poetry</em>, those containing both words being displayed on top</li>
<li><em>~(poetry + french) (literature ameri*)</em> will recall all records <b>not containing</b> <em>poetry</em> <b>!!operator_more_uppercase!!</b> <em>french</em>, from these records, those containing <em>literature</em> <b>!!operator_uppercase!!</b> <em>ameri*</em> appearing on top in the results (first <em>literature</em> <b>!!operator_more_uppercase!!</b> <em>ameri*</em>, then <em>ameri*</em>, and finally <em>literature</em>)</li>
</ul>
";

$operator = ($pmb_default_operator ? $msg['search_and'] : $msg['search_or']);
$operator_more = ($pmb_default_operator ? $msg['search_or'] : $msg['search_and']);
$content = str_replace('!!operator_uppercase!!', strtoupper($operator), $content);
$content = str_replace('!!operator_lowercase!!', strtolower($operator), $content);
$content = str_replace('!!operator_more_uppercase!!', strtoupper($operator_more), $content);
$content = str_replace('!!operator_more_lowercase!!', strtolower($operator_more), $content);
print $content;

?>
