<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          XegerJavaScript 正則表達(dá)式

          聯(lián)合創(chuàng)作 · 2023-09-30 13:49

          Xeger 是更富有表現(xiàn)力的 JavaScript 正則表達(dá)式,Xeger 發(fā)音為 "zeeger"。

          使用:

          var xeger = require('xeger');
          /* Parsing a URL. Getting the schema, host, path, and url params */
          /* Instead of this */
          var boringRegex= /(https?)\:\/\/([^\/]+)(.+)\?(.*)/;
          /* Write this! */
          var coolRegex = xeger(function (x) {
            /* schema */
            x.group(function (x) {
              x.literal('http');
              x.literal('s', { optional: true });
            });
            x.literal('://');
            /* host */
            x.group(function (x) {
              x.not('/', { multiple: true });
            });
            /* path */
            x.group(function (x) {
              x.any({ multiple: true });
            });
            x.literal('?');
            /* query params */
            x.group(function (x) {
              x.any({ multiple: true, optional: true });
            });
          });
          var matched = coolRegex.exec('https://www.google.com/search?q=my_search');

          匹配:

          [ 'https://www.google.com/search?q=my_search',
            'https',          /* schema       */
            'www.google.com', /* host         */
            '/search',        /* path         */
            'q=my_search',    /* query params */
            index: 0,
            input: 'https://www.google.com/search?q=my_search' ]

           

          瀏覽 18
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  精品艹逼 | 91在线无码精品秘 入口色 | 翔田千里中文字幕 | 无码精品一区二区在线 | 操操干|