我怎样才能改进以下preg_match_all模式,所以我没有这个警告:
preg_match_all():编译失败:正则表达式在偏移量 32036 处太大
$sql = "SELECT skills FROM weighted_skills_industry
WHERE industry = 'Engineering' ORDER by LENGTH(skills) DESC LIMIT 3000";
$result = $con->query($sql);
while($row = $result->fetch_assoc()) {
$skill[] = $row['skills'];
}
$pattern = '~(?<![\w-])(?:' . implode('|', array_map(function($i) { return preg_quote($i, '~'); }, $skill)) . ')(?![\w-])~i';
if (preg_match_all($pattern, $text, $matchWords)) {
//write something
}
慕莱坞森
郎朗坤