久久久久久久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 用戶名的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在函數(shù)中使用了模式 /[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 用戶名,但我遇到了困難,因為它沒有給我一個有效的結(jié)果.

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

                  使用以下內(nèi)容:

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

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

                  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

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

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

                  相關(guān)文檔推薦

                  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 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                  <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>
                            主站蜘蛛池模板: 在线一区二区三区四区 | 日本国产欧美 | 亚洲免费看片 | 手机看片福利视频 | 人与拘一级a毛片 | 嫩草在线视频 | 国产乱人乱偷精品视频 | 成年视频在线观看 | 中文字幕丰满人伦在线 | 日韩国产在线播放 | 精品久久网站 | 日韩黄网 | 伊人2222| 婷婷六月激情 | 一区二区三区中文字幕 | 久久久久久亚洲精品 | 国产亚洲欧美日韩高清 | 久久精品一区二区三区四区 | 天天射影院 | 成人一区二区三区四区 | 国产免费小视频 | 免费日韩视频 | 国产天堂在线观看 | 亚洲一级免费视频 | 国产一级片网站 | 日韩在线网址 | 99久久久国产精品 | 国产成人在线播放 | 久久综合伊人 | 亚洲免费精品视频 | 欧美一区二区三区的 | 免费亚洲婷婷 | 久久香蕉网 | 国产精品第一 | 日韩av在线网站 | 国产在线视频一区二区 | 欧美国产日韩视频 | 欧美日韩中文字幕在线观看 | 成年人一级片 | 欧美高清在线 | 中文精品一区 |