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

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Naren Karthik
  • 349
  • 2
  • 9

1 Answers1

3
<?php
$keyword = preg_quote( $keyword, '/' );

$regex = '/\b'.$keyword.'\b/i'; // case insensitive match
if (preg_match($regex, $linkedin_html) == 0)
{
   $this->_htmlValidationFailed++;
   continue;                
}
Berry Langerak
  • 18,561
  • 4
  • 45
  • 58
  • thanks berry.. but now it says..Warning: preg_match(): Compilation failed: regular expression is too large at offset #######. – Naren Karthik Jul 09 '12 at 11:55
  • @NarenKarthik Well, I'm guessing that means that your regular expression is too large ;) If you're just testing for keywords, maybe a loop with strstr is a better fit than a regular expression? – Berry Langerak Jul 09 '12 at 13:06