Logo Search packages:      
Sourcecode: qt-x11-free version File versions

bool QRegExp::exactMatch ( const QString str  )  const

Returns TRUE if str is matched exactly by this regular expression; otherwise returns FALSE. You can determine how much of the string was matched by calling matchedLength().

For a given regexp string, R, exactMatch("R") is the equivalent of search("^R$") since exactMatch() effectively encloses the regexp in the start of string and end of string anchors, except that it sets matchedLength() differently.

For example, if the regular expression is blue, then exactMatch() returns TRUE only for input blue. For inputs bluebell, blutak and lightblue, exactMatch() returns FALSE and matchedLength() will return 4, 3 and 0 respectively.

Although const, this function sets matchedLength(), capturedTexts() and pos().

See also:
search() searchRev() QRegExpValidator

Definition at line 3582 of file qregexp.cpp.

References QString::length().

Referenced by QDir::match(), QRegExpValidator::validate(), and QDoubleValidator::validate().

    prepareEngineForMatch( str );
    eng->match( str, 0, priv->min, TRUE, 0, priv->captured );
    if ( priv->captured[1] == (int) str.length() ) {
      return TRUE;
    } else {
      priv->captured[0] = 0;
      priv->captured[1] = eng->partialMatchLength();
      return FALSE;

Generated by  Doxygen 1.6.0   Back to index