当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Unknown modifier 'v' when using preg_match() expression in regex

问题描述:

 $regex = '/\b'.$keyword.'\b/i'; // case insensitive match

if (preg_match($regex, $linkedin_html) == 0)

{

$this->_htmlValidationFailed++;

continue;

}

When I use this code.. i get error as unknown modifier 'v'..

pls let me know what is the problem and help me rectify.

网友答案:
<?php
$keyword = preg_quote( $keyword, '/' );

$regex = '/\b'.$keyword.'\b/i'; // case insensitive match
if (preg_match($regex, $linkedin_html) == 0)
{
   $this->_htmlValidationFailed++;
   continue;                
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: