<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class XKeywordsUtil { public static function match($rN1ol, $xMSF0, &$pkEJG = null) { goto i7VBX; YW1CQ: return false; goto wRDmJ; zsuqG: if (empty($rN1ol)) { return false; } goto Dk3Hc; Dk3Hc: $I_JnK = explode(',', $rN1ol); goto pjcmT; pjcmT: foreach ($I_JnK as $Nrp0b) { if (false !== strpos($xMSF0, $Nrp0b)) { $pkEJG = $Nrp0b; return true; } else { if (substr($Nrp0b, 0, 1) === '@') { if (@preg_match('/' . substr($Nrp0b, 1) . '/', $xMSF0)) { $pkEJG = $Nrp0b; return true; } } else { if (false !== strpos($Nrp0b, ' ')) { goto vyTAI; vyTAI: $QWbJt = true; goto K9h_L; K9h_L: foreach (explode(' ', $Nrp0b) as $U9AsU) { if (false === strpos($xMSF0, $U9AsU)) { $QWbJt = false; break; } } goto vEZUH; vEZUH: if ($QWbJt) { $pkEJG = $Nrp0b; return true; } goto GBMXD; GBMXD: } else { if (preg_match('/((\\*)(\\d+))[^\\d]/', $Nrp0b, $zhVL6)) { goto uTXs3; SN7hL: if (@preg_match($Dk2je, $xMSF0)) { $pkEJG = $Nrp0b; return true; } goto cgo_3; uTXs3: $qG1sA = explode($zhVL6[1], $Nrp0b); goto NtlhD; NtlhD: $Dk2je = '/' . preg_quote($qG1sA[0]) . '.{3,' . $zhVL6[3] * 3 . '}' . preg_quote($qG1sA[1]) . '/'; goto SN7hL; cgo_3: } else { if (false !== strpos($Nrp0b, '*')) { goto T3pWj; z6yKm: if (@preg_match($Dk2je, $xMSF0)) { $pkEJG = $Nrp0b; return true; } goto q88UO; Qatov: $Dk2je = '/' . preg_quote($qG1sA[0]) . '.+' . preg_quote($qG1sA[1]) . '/'; goto z6yKm; T3pWj: $qG1sA = explode('*', $Nrp0b); goto Qatov; q88UO: } } } } } } goto YW1CQ; i7VBX: $rN1ol = trim($rN1ol); goto zsuqG; wRDmJ: } public static function description() { $PmoCK = '正则类型
- 简单包含匹配: "你好" 匹配 "你好"多条使用,分割
- 同时包含匹配: "你 好" 匹配 "你们好"、"你们好"、"很好你们"
- 广泛包含匹配: "你*好" 匹配 "你们好"、"你们很好"，*匹配一个或多个
- 限制匹配: "你*1好" 匹配 "你们好"，不能匹配"你们很好"，数字表示最长多少个汉字字符，1个汉字=3英文字母
- 标准正则："@正则表达式" 匹配 "正则表达式"，@开头表示正则表达式
使用说明
- 多个正则使用半角逗号,分割'; return $PmoCK; } public static function test() { goto u9exH; Kz1zu: for ($K3Ni_ = 0; $K3Ni_ < count($P_Yoh); $K3Ni_ += 2) { $RgydD[] = sprintf('%-10s%-20s%s', $P_Yoh[$K3Ni_], $P_Yoh[$K3Ni_ + 1], json_encode(self::match($P_Yoh[$K3Ni_], $P_Yoh[$K3Ni_ + 1]))); } goto HjSmI; u9exH: $P_Yoh = array('你好', '你好', '你好', '你们好', '你 好', '你们好', '你*好', '你们好', '你*1好', '你们好', '你*1好', '你们很好', '你*2好', '你们很好', '@你们', '你们很好', '@你好', '你们很好'); goto JR2sc; HjSmI: return join('
', $RgydD); goto jCkyh; JR2sc: $RgydD = array(); goto Kz1zu; jCkyh: } }