<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 問題 Problem 你需要編寫一個復雜的正則表達式。 You need to write a complex regular expression. ## 方法 Solution 使用CoffeeScript的“頂點”——對正則表達式進行了擴展,可以忽略正則中的空格,還可以包含注釋。 Use Coffeescript’s “heregexes” – extended regular expressions that ignore internal whitespace and can contain comments. ~~~ pattern = /// ^\(?(\d{3})\)? # Capture area code, ignore optional parens [-\s]?(\d{3}) # Capture prefix, ignore optional dash or space -?(\d{4}) # Capture line-number, ignore optional dash /// [area_code, prefix, line] = "(555)123-4567".match(pattern)[1..3] # => ['555', '123', '4567'] ~~~ ## 討論 Discussion 把你的正則表達式分割開,并給關鍵的部分添加注釋,可以讓正則表達式更容易理解和維護。例如,改變這個正則,使得前綴和line-number之間可以有空格,就很明顯了。 Breaking up your complex regular expressions and commenting key sections makes them a lot more decipherable and maintainable. For example, changing this regex to allow an optional space between the prefix and line number would now be fairly obvious. ### 在頂點總的空字符 Whitespace characters in heregexes 既然空格符在heregexes中被省略掉了,那如果你需要匹配一個字面的ASCII空格該怎么辦呢? Whitespace is ignored in heregexes – so what do you do if you need to match a literal ASCII space? 一種方法就是使用@\s@這個字符類,它可以匹配空格、tab和換行。如果你只想匹配一個空格,那就需要使用`\x20`來表示一個字面的ASCII空格符。 One solution is to use the @\s@ character class, which will match spaces, tabs and line breaks. If you only want to match a space, though, you’ll need to use?`\x20`?to denote a literal ASCII space.
                  <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>

                              哎呀哎呀视频在线观看