<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                >常用正則 ~~~ ([\s\S]*?) 表示任意多個字符,換行也可以匹配 ([\s*]+) 匹配一個或多個空格 ([\s,]+) 匹配多個空格或逗號 ([,]+) 匹配多個逗號 /php/i 不區分大小寫 ^ $ 匹配開始結束字符 . 匹配除換行以外字符串 ? 0次 或 1次 等價{0,1} * 0次 或 多次 等價{0,} + 1次 或 多次 等價{1,} - 表示范圍 [] 開始結束字符類定義 \d 任意10進制數字 [0-9] \s 任意空白字符 單個 \S 任意非空白字符 \w 任意單詞字符 等價[a-zA-Z0-9] (?:中國|美國)(.*) 匹配中國,美國開頭的字符串 (\d+\.\d+\.\d+\.\d+) IP ([a-zA-Z][a-zA-Z0-9_]) 匹配是否合法字母開頭 (\d-\d|\d-\d) 電話號碼 [1-9][0-9] qq ^[\w\.\-]+@\w+([\.\-]\w+)*\.\w+$ email href="(.*?)" 超鏈接 /^\d{1,6}$/ 匹配0-999999 /\d{4}年\d{1,2}月\d{1,2}/ 匹配年月日 ~~~ >preg_math 匹配一次,成功返回 true ~~~ preg_match("/\<center>([\s\S]*?)<\/center\>/",$str,$rs); ~~~ >preg_match_all匹配多次,成功返回true ~~~ preg_match_all("/\<center>([\s\S]*?)<\/center\>/",$str,$rs); ~~~ >preg_replace 匹配替換,替換成$re ~~~ $rs =preg_replace("/\<center>([\s\S]*?)<\/center\>/",$re,$str); ~~~ >preg_split分割成數組 ~~~ $arr = preg_split('/([\s*]+)/',"a b c d ef"); ~~~ 替換 ~~~ $str = "選項[http://127.0.0.1/weixin/addons/yoby_diyform/weui/fm.jpg]你好"; $str1 = preg_replace("/(?:\[)(.*?)(?:\])/i", "<img src=\"\${1}\" />", $str); preg_replace("/.*\|(.*?)\|.*/i", "\${1}", $v); 字符|120000|來了 輸出120000 ~~~ \s+ 多個空白 [^>] >左邊任意字符 .*? 任意多個字符 \d+ 匹配數字 ~~~ /*獲取html并用正則處理*/ function get_content($url){ $html = file_get_contents($url); $code= mb_detect_encoding($html, array("GB2312","GBK",'UTF-8','BIG5'));//獲取編碼 if($code!="UTF-8"){ $htmls = mb_convert_encoding($html, "UTF-8", $code);//轉換內容為UTF-8編碼 }else{ $htmls = $html; } $htmls = preg_replace("/<script[\s\S]*?<\/script>/i","",$htmls,-1);//去除script $htmls = preg_replace("/<noscript[\s\S]*?<\/noscript>/i","",$htmls,-1);//去除noscript $htmls=preg_replace("/<(\/?link.*?)>/si","",$htmls);//去掉link $htmls=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$htmls);//去掉style $htmls =preg_replace("/style=.+?['|\"]/i",'',$htmls,-1);//去除style行內樣式 $htmls =preg_replace('#<!--[^\!\[]*?(?<!\/\/)-->#' , '' , $htmls);//去掉html注釋 $htmls = preg_replace("/<a[^>]*>(.*?)<\/a>/is", "$1", $htmls);//去除外站超鏈接 $htmls = preg_replace("/(\n\r)/i", '', $htmls); //去掉空行 return $htmls; } preg_match('/<div class="infoBox-list".*?>.*?<div class="news-page clearfix">/ism', $htmls, $rs); $htmls = $rs[0];//獲取兩個class之間內容 $url = (preg_match('/^http(s)?:\\/\\/.+/',$url))?$url:"http:// ".$url;//判斷是否包含https/http preg_match("/src=\"\/?(.*?)\"/",$content,$match); 第一張圖片 ~~~ ~~~ [\u4e00-\u9fa5]{0,} 匹配中文 \d+ 匹配>=0數字 [a-zA-Z]+ 不區分大小寫26個字母 [A-Za-z0-9]+ 英文與數字 \s+ 多個空格 [0-9]* 匹配一串數字 \d{4} 匹配四位數字 \d{5,} 匹配至少5位數 \d{4,10} 匹配4-10位數 ~~~
                  <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>

                              哎呀哎呀视频在线观看