<class name="QRegExpValidator" doc="/**
&lt;p&gt;The &lt;a href=&quot;QRegExpValidator.html#QRegExpValidator(com.trolltech.qt.core.QRegExp, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt; class is used to check a string against a regular expression.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QRegExpValidator.html#QRegExpValidator(com.trolltech.qt.core.QRegExp, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt; uses a regular expression (regexp) to determine whether an input string is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt;, or &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;. The regexp can either be supplied when the &lt;a href=&quot;QRegExpValidator.html#QRegExpValidator(com.trolltech.qt.core.QRegExp, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt; is constructed, or at a later time.&lt;/p&gt;
&lt;p&gt;When &lt;a href=&quot;QRegExpValidator.html#QRegExpValidator(com.trolltech.qt.core.QRegExp, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt; determines whether a string is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt; or not, the regexp is treated as if it begins with the start of string assertion (&lt;b&gt;^&lt;/b&gt;) and ends with the end of string assertion (&lt;b&gt;$&lt;/b&gt;); the match is against the entire input string, or from the given position if a start position greater than zero is given.&lt;/p&gt;
&lt;p&gt;If a string is a prefix of an &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt; string, it is considered &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt;. For example, &amp;quot;&amp;quot; and &amp;quot;A&amp;quot; are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; for the regexp &lt;b&gt;[A-Z][0-9]&lt;/b&gt; (whereas &amp;quot;_&amp;quot; would be &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;For a brief introduction to Qt's regexp engine, see &lt;a href=&quot;%2E%2E/core/QRegExp.html&quot;&gt;&lt;tt&gt;QRegExp&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Example of use:&lt;/p&gt;
&lt;pre&gt;&lt;span class=&quot;comment&quot;&gt;    //&lt;/span&gt; regexp: optional '-' followed by between 1 and 3 digits
    QRegExp rx(&amp;quot;-?\\d{1,3}&amp;quot;);
    QValidator *validator = new QRegExpValidator(rx, this);

    QLineEdit *edit = new QLineEdit(this);
    edit-&amp;gt;setValidator(validator);&lt;/pre&gt;
&lt;p&gt;Below we present some examples of validators. In practice they would normally be associated with a widget as in the example above.&lt;/p&gt;
&lt;pre&gt;&lt;span class=&quot;comment&quot;&gt;    //&lt;/span&gt; integers 1 to 9999
    QRegExp rx(&amp;quot;[1-9]\\d{0,3}&amp;quot;);
&lt;span class=&quot;comment&quot;&gt;    //&lt;/span&gt; the validator treats the regexp as &amp;quot;^[1-9]\\d{0,3}$&amp;quot;
    QRegExpValidator v(rx, 0);
    QString s;
    int pos = 0;

    s = &amp;quot;0&amp;quot;;     v.validate(s, pos);    &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; returns Invalid
    s = &amp;quot;12345&amp;quot;; v.validate(s, pos);    &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; returns Invalid
    s = &amp;quot;1&amp;quot;;     v.validate(s, pos);    &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; returns Acceptable

    rx.setPattern(&amp;quot;\\S+&amp;quot;);            &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; one or more non-whitespace characters
    v.setRegExp(rx);
    s = &amp;quot;myfile.txt&amp;quot;;  v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Acceptable
    s = &amp;quot;my file.txt&amp;quot;; v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Invalid

&lt;span class=&quot;comment&quot;&gt;    //&lt;/span&gt; A, B or C followed by exactly five digits followed by W, X, Y or Z
    rx.setPattern(&amp;quot;[A-C]\\d{5}[W-Z]&amp;quot;);
    v.setRegExp(rx);
    s = &amp;quot;a12345Z&amp;quot;; v.validate(s, pos);        &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Invalid
    s = &amp;quot;A12345Z&amp;quot;; v.validate(s, pos);        &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Acceptable
    s = &amp;quot;B12&amp;quot;;     v.validate(s, pos);        &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Intermediate

&lt;span class=&quot;comment&quot;&gt;    //&lt;/span&gt; match most 'readme' files
    rx.setPattern(&amp;quot;read\\S?me(\.(txt|asc|1st))?&amp;quot;);
    rx.setCaseSensitive(false);
    v.setRegExp(rx);
    s = &amp;quot;readme&amp;quot;;      v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Acceptable
    s = &amp;quot;README.1ST&amp;quot;;  v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Acceptable
    s = &amp;quot;read me.txt&amp;quot;; v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Invalid
    s = &amp;quot;readm&amp;quot;;       v.validate(s, pos); &lt;span class=&quot;comment&quot;&gt;//&lt;/span&gt; Returns Intermediate&lt;/pre&gt;

@see &lt;a href=&quot;%2E%2E/core/QRegExp.html&quot;&gt;&lt;tt&gt;QRegExp&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QIntValidator.html&quot;&gt;&lt;tt&gt;QIntValidator&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDoubleValidator.html&quot;&gt;&lt;tt&gt;QDoubleValidator&lt;/tt&gt;&lt;/a&gt;
@see Settings Editor Example&lt;/tt&gt; */">
    <method name="public QRegExpValidator(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs a validator with a &lt;tt&gt;parent&lt;/tt&gt; object that accepts any string (including an empty one) as valid.&lt;/p&gt;
 */"/>
    <method name="public QRegExpValidator(com.trolltech.qt.core.QRegExp rx, com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs a validator with a &lt;tt&gt;parent&lt;/tt&gt; object that accepts all strings that match the regular expression &lt;tt&gt;rx&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The match is made against the entire string; e.g&amp;#x2e; if the regexp is &lt;b&gt;[A-Fa-f0-9]+&lt;/b&gt; it will be treated as &lt;b&gt;^[A-Fa-f0-9]+$&lt;/b&gt;.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QRegExp regExp()" doc="/**
&lt;p&gt;Returns the regular expression used for validation.&lt;/p&gt;

@see &lt;a href=&quot;QRegExpValidator.html#setRegExp(com.trolltech.qt.core.QRegExp)&quot;&gt;&lt;tt&gt;setRegExp&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setRegExp(com.trolltech.qt.core.QRegExp rx)" doc="/**
&lt;p&gt;Sets the regular expression used for validation to &lt;tt&gt;rx&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QRegExpValidator.html#regExp()&quot;&gt;&lt;tt&gt;regExp&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.gui.QValidator.State validate(com.trolltech.qt.gui.QValidator.QValidationData input)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QRegExpValidator.html#validate(com.trolltech.qt.gui.QValidator.QValidationData)&quot;&gt;validate&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;input&lt;/tt&gt;, ). */"/>
</class>
