久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='K8tKt'></bdo><ul id='K8tKt'></ul>

    1. <tfoot id='K8tKt'></tfoot>
    2. <legend id='K8tKt'><style id='K8tKt'><dir id='K8tKt'><q id='K8tKt'></q></dir></style></legend>

      <small id='K8tKt'></small><noframes id='K8tKt'>

      <i id='K8tKt'><tr id='K8tKt'><dt id='K8tKt'><q id='K8tKt'><span id='K8tKt'><b id='K8tKt'><form id='K8tKt'><ins id='K8tKt'></ins><ul id='K8tKt'></ul><sub id='K8tKt'></sub></form><legend id='K8tKt'></legend><bdo id='K8tKt'><pre id='K8tKt'><center id='K8tKt'></center></pre></bdo></b><th id='K8tKt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='K8tKt'><tfoot id='K8tKt'></tfoot><dl id='K8tKt'><fieldset id='K8tKt'></fieldset></dl></div>
      1. 如何使用正則表達式驗證 Twitter 用戶名

        How to validate a Twitter username using Regex(如何使用正則表達式驗證 Twitter 用戶名)
        <tfoot id='FLCoa'></tfoot>

          <legend id='FLCoa'><style id='FLCoa'><dir id='FLCoa'><q id='FLCoa'></q></dir></style></legend>
          • <i id='FLCoa'><tr id='FLCoa'><dt id='FLCoa'><q id='FLCoa'><span id='FLCoa'><b id='FLCoa'><form id='FLCoa'><ins id='FLCoa'></ins><ul id='FLCoa'></ul><sub id='FLCoa'></sub></form><legend id='FLCoa'></legend><bdo id='FLCoa'><pre id='FLCoa'><center id='FLCoa'></center></pre></bdo></b><th id='FLCoa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FLCoa'><tfoot id='FLCoa'></tfoot><dl id='FLCoa'><fieldset id='FLCoa'></fieldset></dl></div>
              • <bdo id='FLCoa'></bdo><ul id='FLCoa'></ul>

                  <tbody id='FLCoa'></tbody>

                  <small id='FLCoa'></small><noframes id='FLCoa'>

                  本文介紹了如何使用正則表達式驗證 Twitter 用戶名的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在函數中使用了模式 /[a-z0-9_]+/i :

                  I have used the pattern /[a-z0-9_]+/i within the function:

                  function validate_twitter($username) {
                   if (eregi('/[a-z0-9_]+/i', $username)) {
                    return true;
                   }
                  }
                  

                  通過這個,我測試輸入是否是有效的 twitter 用戶名,但我遇到了困難,因為它沒有給我一個有效的結果.

                  With this, I test if the input is a valid twitter username, but i'm having difficulties as it is not giving me a valid result.

                  誰能幫我找到解決辦法.

                  Can someone help me find a solution.

                  推薦答案

                  驗證字符串是否為有效的 Twitter 句柄:

                  To validate if a string is a valid Twitter handle:

                  function validate_username($username)
                  {
                      return preg_match('/^[A-Za-z0-9_]{1,15}$/', $username);
                  }
                  

                  如果您嘗試在字符串中匹配 @username.

                  If you are trying to match @username within a string.

                  例如:RT @username: lorem ipsum @cjoudrey etc...

                  使用以下內容:

                  $string = 'RT @username: lorem ipsum @cjoudrey etc...';
                  preg_match_all('/@([A-Za-z0-9_]{1,15})/', $string, $usernames);
                  print_r($usernames);
                  

                  您可以將后者與 preg_replace_callback 結合使用以鏈接字符串中的用戶名.

                  You can use the latter with preg_replace_callback to linkify usernames in a string.

                  Twitter 還開源文本庫用于 Java 和Ruby 用于匹配用戶名、哈希標簽等.您可以查看代碼并找到它們使用的正則表達式模式.

                  Twitter also open sourced text libraries for Java and Ruby for matching usernames, hash tags, etc.. You could probably look into the code and find the regex patterns they use.

                  編輯 (2):這是 Twitter 文本庫的 PHP 端口:https://github.com/mzsanford/twitter-text-php#readme

                  Edit (2): Here is a PHP port of the Twitter Text Library: https://github.com/mzsanford/twitter-text-php#readme

                  這篇關于如何使用正則表達式驗證 Twitter 用戶名的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  <tfoot id='HQzk2'></tfoot>
                    <tbody id='HQzk2'></tbody>
                    1. <small id='HQzk2'></small><noframes id='HQzk2'>

                        <bdo id='HQzk2'></bdo><ul id='HQzk2'></ul>
                        <legend id='HQzk2'><style id='HQzk2'><dir id='HQzk2'><q id='HQzk2'></q></dir></style></legend>

                            <i id='HQzk2'><tr id='HQzk2'><dt id='HQzk2'><q id='HQzk2'><span id='HQzk2'><b id='HQzk2'><form id='HQzk2'><ins id='HQzk2'></ins><ul id='HQzk2'></ul><sub id='HQzk2'></sub></form><legend id='HQzk2'></legend><bdo id='HQzk2'><pre id='HQzk2'><center id='HQzk2'></center></pre></bdo></b><th id='HQzk2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HQzk2'><tfoot id='HQzk2'></tfoot><dl id='HQzk2'><fieldset id='HQzk2'></fieldset></dl></div>
                            主站蜘蛛池模板: 精品一区二区久久久久久久网站 | 武道仙尊动漫在线观看 | 亚洲成人av | 欧美国产亚洲一区二区 | 日韩欧美精品一区 | 亚洲国产免费 | 国产精品久久二区 | a欧美| 久久av一区二区三区 | 亚洲视频一区二区三区 | 黄色一级大片在线免费看产 | 亚洲电影第1页 | 在线观看黄视频 | 亚洲精品免费视频 | 色爱综合网 | 黄色毛片黄色毛片 | av入口 | 日韩超碰| 亚洲欧美中文日韩在线v日本 | 日本在线精品视频 | 九九亚洲 | 久久久激情视频 | 欧美久久一级特黄毛片 | 国产精品久久久久久238 | 国产日韩av一区二区 | 四虎影音| 亚洲美女视频 | 男女下面一进一出网站 | 亚洲精选一区二区 | 亚洲精品永久免费 | 毛片.com | 91精品国产乱码久久久久久久 | 色又黄又爽网站www久久 | 亚洲三级在线观看 | 精品视频在线一区 | 日韩一区二区视频 | 精品三区 | caoporn免费在线视频 | 国产精品久久久久aaaa樱花 | 日日摸日日爽 | 最新中文字幕在线 |