<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QRegExpValidator Class Reference ## [[QtGui](index.htm) module] 該QRegExpValidator類是用來檢查與正則表達式的字符串。[More...](#details) 繼承[QValidator](qvalidator.html)。 ### Methods * `__init__ (self, QObject?parent?=?None)` * `__init__ (self, QRegExp?rx, QObject?parent?=?None)` * `QRegExp regExp (self)` * `setRegExp (self, QRegExp?rx)` * `(QValidator.State, QString?input, int?pos) validate (self, QString?input, int?pos)` * `(QValidator.State, int?pos) validate (self, QString?input, int?pos)` * * * ## Detailed Description 該QRegExpValidator類是用來檢查與正則表達式的字符串。 QRegExpValidator使用正則表達式(正則表達式)來確定一個輸入字符串是否是[Acceptable](qvalidator.html#State-enum),[Intermediate](qvalidator.html#State-enum)或[Invalid](qvalidator.html#State-enum)。當QRegExpValidator構造正則表達式可以被提供,或者在稍后的時間。 當QRegExpValidator判斷一個字符串是否是[Acceptable](qvalidator.html#State-enum)還是不行,正則表達式被視為其與字符串斷言的啟動開始(**^**),并用繩子斷言年底結束(**$**) ;匹配是對整個輸入字符串,或者從給定的位置,如果開始位置大于零給出。 如果一個字符串的前綴[Acceptable](qvalidator.html#State-enum)串,它被認為是[Intermediate](qvalidator.html#State-enum)。例如, “ ”和“A”是[Intermediate](qvalidator.html#State-enum)為正則表達式**[A-Z][0-9]**(而“[_](index.html)“將是[Invalid](qvalidator.html#State-enum)) 。 對于簡要介紹了Qt的正則表達式引擎,請參閱[QRegExp](qregexp.html)。 使用示例: ``` // regexp: optional '-' followed by between 1 and 3 digits [QRegExp](qregexp.html) rx("-?\\d{1,3}"); [QValidator](qvalidator.html) *validator = new QRegExpValidator(rx, this); [QLineEdit](qlineedit.html) *edit = new [QLineEdit](qlineedit.html)(this); edit->setValidator(validator); ``` 下面,我們提出校驗器的一些例子。在實踐中,它們通常會被一個小部件如在上面的例子有關。 ``` // integers 1 to 9999 [QRegExp](qregexp.html) rx("[1-9]\\d{0,3}"); // the validator treats the regexp as "^[1-9]\\d{0,3}$" QRegExpValidator v(rx, 0); [QString](qstring.html) s; int pos = 0; s = "0"; v.validate(s, pos); // returns Invalid s = "12345"; v.validate(s, pos); // returns Invalid s = "1"; v.validate(s, pos); // returns Acceptable rx.setPattern("\\S+"); // one or more non-whitespace characters v.setRegExp(rx); s = "myfile.txt"; v.validate(s, pos); // Returns Acceptable s = "my file.txt"; v.validate(s, pos); // Returns Invalid // A, B or C followed by exactly five digits followed by W, X, Y or Z rx.setPattern("[A-C]\\d{5}[W-Z]"); v.setRegExp(rx); s = "a12345Z"; v.validate(s, pos); // Returns Invalid s = "A12345Z"; v.validate(s, pos); // Returns Acceptable s = "B12"; v.validate(s, pos); // Returns Intermediate // match most 'readme' files rx.setPattern("read\\S?me(\.(txt|asc|1st))?"); rx.setCaseSensitive(false); v.setRegExp(rx); s = "readme"; v.validate(s, pos); // Returns Acceptable s = "README.1ST"; v.validate(s, pos); // Returns Acceptable s = "read me.txt"; v.validate(s, pos); // Returns Invalid s = "readm"; v.validate(s, pos); // Returns Intermediate ``` * * * ## Method Documentation ``` QRegExpValidator.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個驗證用_parent_對象接受任何字符串(包括空單)為有效。 ``` QRegExpValidator.__init__ (self, QRegExp?rx, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個驗證用_parent_對象接受匹配正則表達式的字符串_rx_。 本場比賽是針對整個字符串,例如如果設置了RegExp是**[A-Fa-f0-9]+**這將被視為**^[A-Fa-f0-9]+$**。 ``` QRegExp QRegExpValidator.regExp (self) ``` [ ``` QRegExpValidator.setRegExp (self, QRegExp?rx) ``` ``` (QValidator.State, QString?input, int?pos) QRegExpValidator.validate (self, QString?input, int?pos) ``` ](qregexp.html) [從重新實現](qregexp.html)[QValidator.validate](qvalidator.html#validate)( ) 。 Returns [Acceptable](qvalidator.html#State-enum)如果_input_匹配的正則表達式為這個校驗器,[Intermediate](qvalidator.html#State-enum)如果它匹配的部分(即可能是一個有效的匹配,如果其他有效字符添加) ,及[Invalid](qvalidator.html#State-enum)如果_input_不匹配。 該_pos_參數被設置為的長度_input_參數。 例如,如果正則表達式是**\w\d\d**(單詞字符,數字,數字),那么“ A57 ”是[Acceptable](qvalidator.html#State-enum), “ E5 ”是[Intermediate](qvalidator.html#State-enum)和“ 9 ”的[Invalid](qvalidator.html#State-enum)。 **See also** [QRegExp.exactMatch](qregexp.html#exactMatch)( ) 。 ``` (QValidator.State, int?pos) QRegExpValidator.validate (self, QString?input, int?pos) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看