<!-- File: $RCSfile: regularexpressions,v $ -->
<!-- Rev: $Revision$ -->

<body class="help">
  <p>

  The <TMPL_VAR PRODUCT> allows the use of regular expressions
in many of the places where a string input is required, such as in
a Log search.
 A regular expression is a combination of characters or character classes and operators which allow text to be
 described for matching purposes. <b>Matches are NOT case-sensitive.</b> All regular
 expressions are lower case before use as is the text against which expressions are
 being matched. For this reason, none of the capital letter character classes
 can be used.
 <br><br>
 <font color=red>Caution:</font> Be careful when using <a href="#specialcharacters">special
   characters</a> such as |, *, '.' as they are not taken literally unless escaped
   with a preceding '\' character.
 <br>
<TMPL_UNLESS IS_BSVF>
    <dl>
       <dt class="help">Topics in this page include:</dt><br>
          <dd class="help"><a href="#operators">Operators</a></dd>
          <dd class="help"><a href="#classes">Character Classes</a></dd>
          <dd class="help"><a href="#misc">Miscellaneous characters</a></dd>
          <dd class="help"><a href="#specialcharacters">Special characters</a></dd>
          <dd class="help"><a href="#examples">Examples</a></dd>
       </dt>
   </dl>
</TMPL_UNLESS>
Topics in this page include:
<br><br>
<TMPL_IF IS_BSVF>
  <ul class="toc">
    <li><a href="#operators">Operators</a>
    <li><a href="#classes">Character Classes</a>
    <li><a href="#misc">Miscellaneous characters</a>
    <li><a href="#specialcharacters">Special characters</a>
    <li><a href="#examples">Examples</a>
  </ul>
</TMPL_IF>
<h2 class="help"><a name="operators">Operators</a></h2>
Operators recognized by the <TMPL_VAR PRODUCT> in regular expressions include:
<ul>
  <li><b>*</b> - zero or more times
  <li><b>+</b> - one or more times
  <li><b>?</b> - zero or one time
  <li><b>|</b> - or
  <li><b>( )</b> - grouping
</ul>

<h2 class="help"><a name="classes">Character Classes</a></h2>
  A character class matches a character or range of characters that is listed between brackets '[' and ']'. A 
  dash ('-') is used to specify a range of characters. Use the '^' character inside the '[' and 
  ']' to negate a class. Some examples are: 
<ul>
  <li><b>.</b> - any character except newline
  <li><b>[ac]</b> - one of the following characters:  a A c C
  <li><b>[^ac]</b> - anything but the characters 'a', 'A', 'c', 'C'
  <li><b>[a-z]</b> - letters 'a' through 'z' regardless of case
  <li><b>[a-z.]</b> - letters 'a' through 'z' or 'A' through 'Z' or a dot 
  <li><b>[a-z\-]</b> - any alphabetic character or a dash
  <li><b>\d</b> - digit, shortcut for <b>[0-9]</b>
  <li><b>[^\d]</b> - non-digit
  <li><b>\w</b> - part of word: shortcut for <b>[A-Za-z0-9_]</b>
  <li><b>[^\w]</b> - non-word character
  <li><b>\s</b> - space character: shortcut for <b>[ \n\r\t]</b>
  <li><b>[^\s]</b> - non-space character
</ul>

<h2 class="help"><a name="misc">Miscellaneous characters</a></h2>
<ul>
  <li><b>^</b> - beginning of line
  <li><b>$</b> - end of line
  <li><b>\b</b> - word boundary
  <li><b>\t</b> - tab character
</ul>

<h2 class="help"><a name="specialcharacters">Special characters</a></h2>
  The following characters have a special meaning in regular 
  expressions on the <TMPL_VAR PRODUCT> and are prepended by a <b>\</b> character 
  when they are interpreted literally: <br>
<ul>
  <li><b>.</b>
  <li><b>[</b>
  <li><b>]</b>
  <li><b>\</b>
  <li><b>*</b>
  <li><b>?</b>
  <li><b>$</b>
  <li><b>(</b>
  <li><b>)</b>
  <li><b>|</b>
  <li><b>^</b>
  <li><b>@</b>
</ul>
<h2 class="help"><a name="examples">Examples</a></h2>
<ul>
  <li><b>\bcialis\b</b> - matches cialis, but not specialist
  <li><b>p[^\w]?h[^\w]?a[^\w]?r[^\w]?m[^\w]?a[^\w]?c[^\w]?y</b> - matches pha,rmacy or P.harm-acy
  <li><b>viagra</b> - matches viagra, VIAGRA or vIaGRa
  <li><b>\d+</b> - matches 1 or more digits: 0, 42, 007
  <li><b>(bad|good)</b> - matches the letters 'bad' or matches the letters 'good'
  <li><b>^free</b> - matches the letters 'free' at the beginning of a line
  <li><b>v[i1]agra</b> - matches viagra or v1agra
  <li><b>v(ia|1a)gra</b> - matches viagRA or v1agra
  <li><b>v\|agra</b> - matches v|Agra, V|Agra, v|agRa, etc.
  <li><b>v(i|1|\|)?agra</b> - matches vagra, viaGra, v1agrA, V|AGRA, etc.
  <li><b>\*FREE\*</b> - matches *FREE*, *frEE*, etc.
  <li><b>\*FREE\* V.*GRA</b> - matches *FREE* VIAGRA, *Free* VEHiCLegrA, etc.
</ul>
</body>
