<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                >[success] # js 正則 ~~~ 1.正則表達式,又稱規則表達式。(英語:Regular Expression,在代碼中常簡寫為regex、regexp或RE), 正則表達式通常被用來檢索、替換那些符合某個模式(規則)的文本。 2.用來匹配字符串 3.正則表達式的組成:是由元字符或者是限定符組成的一個式子 ~~~ >[danger] ##### 元字符 ![](https://img.kancloud.cn/76/0f/760fe2fd3b181914df2d7845a808738a_1393x370.png) ![](https://img.kancloud.cn/43/56/4356881e2df0fde167d9881e91c0dd91_1124x531.png) >[danger] ##### 字符集合 ![](https://img.kancloud.cn/9b/24/9b2486c1e0c157f43a962c9c27c03e52_1300x313.png) >[danger] ##### 量詞 ![](https://img.kancloud.cn/62/2d/622dcf573dc7e7beea86187703119c20_1171x545.png) >[danger] ##### 分支 ![](https://img.kancloud.cn/a7/3c/a73cd24bdb88b8f8044777e067072c80_1318x202.png) >[danger] ##### 貪婪與懶惰 ~~~ 1.'貪婪模式'——在匹配成功的前提下,盡可能多的去匹配 2.'惰性模式'——在匹配成功的前提下,盡可能少的去匹配 說明:js 正則默認是貪婪模式,就是符合情況下盡可能多的去匹配 ~~~ ~~~ const str = 'I want you to (match the content) between the bracket)'; // 貪婪匹配只要滿足我都要 console.log(/((.*))/.exec(str)); // 惰性遇到? 問號的意思是滿足零次或者一次 也就是最少次數 // + 加號的意思是一次或者多次也就是 配合問號最少次數 則滿足一次即可 console.log(/((.+?))/.exec(str)); // 找到滿足非( 開始的字符以貪婪匹配則滿足的都要 console.log(/(([^(]*))/.exec(str)); // 找到滿足非( 開始的字符以惰性匹配則滿足即第一個滿足 console.log(/(([^(]+?))/.exec(str)); ~~~ * 輸出打印結果 ~~~ [ 'I want you to (match the content) between the bracket)', 'I want you to (match the content) between the bracket)', 'I want you to (match the content) between the bracket)', index: 0, input: 'I want you to (match the content) between the bracket)', groups: undefined ] [ 'I', 'I', 'I', index: 0, input: 'I want you to (match the content) between the bracket)', groups: undefined ] [ 'I want you to ', 'I want you to ', 'I want you to ', index: 0, input: 'I want you to (match the content) between the bracket)', groups: undefined ] [ 'I', 'I', 'I', index: 0, input: 'I want you to (match the content) between the bracket)', groups: undefined ] ~~~
                  <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>

                              哎呀哎呀视频在线观看