<?xml version="1.0" encoding="ISO-8859-1"?>

<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

  <properties>
    <title>Regexp</title>
    <author>Checkstyle Development Team</author>
  </properties>

  <body>
    <section name="RegexpSingleline">
      <subsection name="Description">
        <p>
          A check for detecting single lines that match a supplied
          regular expression. Works with any file type.
        </p>

        <p>
          Rationale: This check can be used to prototype checks and to
          find common bad practice such as calling <code>ex.printStacktrace()</code>, <code>
          System.out.println()</code>, <code>System.exit()</code>, etc.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>format</td>
            <td>illegal pattern</td>
            <td><a href="property_types.html#regexp">regular expression</a></td>
            <td><code>^$</code> (empty)</td>
          </tr>
          <tr>
            <td>message</td>
            <td>message which is used to notify about violations,
            if empty then default(hard-coded) message is used.</td>
            <td><a href="property_types.html#string">String</a></td>
            <td><code>&quot;&quot;</code>(empty)</td>
          </tr>
          <tr>
            <td>ignoreCase</td>
            <td>Controls whether to ignore case when searching.</td>
            <td><a href="property_types.html#boolean">Boolean</a></td>
            <td><code>false</code></td>
          </tr>
          <tr>
            <td>minimum</td>
            <td>The minimum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>maximum</td>
            <td>The maximum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>fileExtensions</td>
            <td>file type extension of files to process</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td><code>{}</code></td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check to find trailing whitespace at the end
          of a line:
        </p>
        <source>
&lt;module name=&quot;RegexpSingleline&quot;&gt;
  &lt;!-- \s matches whitespace character, $ matches end of line. --&gt;
  &lt;property name=&quot;format&quot; value=&quot;\s+$&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          To configure the check to find trailing whitespace at the end
          of a line, with some <i>slack</i> of allowing two occurances
          per file:
        </p>
        <source>
&lt;module name=&quot;RegexpSingleline&quot;&gt;
  &lt;property name=&quot;format&quot; value=&quot;\s+$&quot;/&gt;
  &lt;!-- next line not required as 0 is the default --&gt;
  &lt;property name=&quot;minimum&quot; value=&quot;0&quot;/&gt;
  &lt;property name=&quot;maximum&quot; value=&quot;2&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          An example of how to configure the check to make sure a copyright
          statement is included in the file:
        </p>
        <source>
&lt;module name=&quot;RegexpSingleline&quot;&gt;
  &lt;property name="format" value="This file is copyrighted"/&gt;
  &lt;property name=&quot;minimum&quot; value=&quot;1&quot;/&gt;
  &lt;!--  Need to specify a maximum, so 10 times is more than enough. --&gt;
  &lt;property name=&quot;maximum&quot; value=&quot;10&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#Checker">Checker</a>
        </p>
      </subsection>
    </section>


    <section name="RegexpMultiline">
      <subsection name="Description">
        <p>
          A check for detecting that matches across multiple lines.
          Works with any file type.
        </p>

        <p>
          Rationale: This check can be used to when the regular
          expression can be span multiple lines.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>format</td>
            <td>illegal pattern</td>
            <td><a href="property_types.html#regexp">regular expression</a></td>
            <td><code>^$</code> (empty)</td>
          </tr>
          <tr>
            <td>message</td>
            <td>message which is used to notify about violations,
            if empty then default(hard-coded) message is used.</td>
            <td><a href="property_types.html#string">String</a></td>
            <td><code>&quot;&quot;</code>(empty)</td>
          </tr>
          <tr>
            <td>ignoreCase</td>
            <td>Controls whether to ignore case when searching.</td>
            <td><a href="property_types.html#boolean">Boolean</a></td>
            <td><code>false</code></td>
          </tr>
          <tr>
            <td>minimum</td>
            <td>The minimum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>maximum</td>
            <td>The maximum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>fileExtensions</td>
            <td>file type extension of files to process</td>
            <td><a href="property_types.html#stringSet">String Set</a></td>
            <td><code>{}</code></td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check to find calls to print to the console:
        </p>
        <source>
&lt;module name=&quot;RegexpMultiline&quot;&gt;
  &lt;property name=&quot;format&quot;
   value=&quot;System\.(out)|(err)\.print(ln)?\(&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#Checker">Checker</a>
        </p>
      </subsection>
    </section>


    <section name="RegexpSinglelineJava">
      <subsection name="Description">
        <p>
          This class is variation on <a
          href="#RegexpSingleline">RegexpSingleline</a> for detecting
          single lines that match a supplied regular expression in Java
          files. It supports suppressing matches in Java comments.
        </p>
      </subsection>

      <subsection name="Properties">
        <table>
          <tr>
            <th>name</th>
            <th>description</th>
            <th>type</th>
            <th>default value</th>
          </tr>
          <tr>
            <td>format</td>
            <td>illegal pattern</td>
            <td><a href="property_types.html#regexp">regular expression</a></td>
            <td><code>^$</code> (empty)</td>
          </tr>
          <tr>
            <td>message</td>
            <td>message which is used to notify about violations,
            if empty then default(hard-coded) message is used.</td>
            <td><a href="property_types.html#string">String</a></td>
            <td><code>&quot;&quot;</code>(empty)</td>
          </tr>
          <tr>
            <td>ignoreCase</td>
            <td>Controls whether to ignore case when searching.</td>
            <td><a href="property_types.html#boolean">Boolean</a></td>
            <td><code>false</code></td>
          </tr>
          <tr>
            <td>minimum</td>
            <td>The minimum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>maximum</td>
            <td>The maximum number of matches required in each file.</td>
            <td><a href="property_types.html#integer">Integer</a></td>
            <td><code>0</code></td>
          </tr>
          <tr>
            <td>ignoreComments</td>
            <td>Controls whether to ignore text in comments when searching.</td>
            <td><a href="property_types.html#boolean">Boolean</a></td>
            <td><code>false</code></td>
          </tr>
        </table>
      </subsection>

      <subsection name="Examples">
        <p>
          To configure the check for calls to <code>System.out.println</code>, except in comments:
        </p>
        <source>
&lt;module name=&quot;RegexpSinglelineJava&quot;&gt;
    &lt;!-- . matches any character, so we need to
         escape it and use \. to match dots. --&gt;
  &lt;property name=&quot;format&quot; value=&quot;System\.out\.println&quot;/&gt;
  &lt;property name=&quot;ignoreComments&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
        </source>

        <p>
          To configure the check to find case-insensitive occurrences of
          &quot;debug&quot;:
        </p>
        <source>
&lt;module name=&quot;RegexpSinglelineJava&quot;&gt;
    &lt;property name=&quot;format&quot; value=&quot;debug&quot;/&gt;
    &lt;property name=&quot;ignoreCase&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
        </source>
      </subsection>

      <subsection name="Package">
        <p>
          com.puppycrawl.tools.checkstyle.checks
        </p>
      </subsection>

      <subsection name="Parent Module">
        <p>
          <a href="config.html#TreeWalker">TreeWalker</a>
        </p>
      </subsection>
    </section>
  </body>
</document>
