protected function getWordsRegexp(array $words)
	{
		$expr  = RegexpBuilder::fromList($words, $this->regexpOptions);
		$regexp = new Regexp('/(?<![\\pL\\pN])' . $expr . '(?![\\pL\\pN])/Siu');

		// JavaScript regexps don't support Unicode properties, so instead of Unicode letters
		// we'll accept any non-whitespace, non-common punctuation
		$expr = str_replace('[\\pL\\pN]', '[^\\s!-\\/:-?]', $expr);
		$expr = str_replace('(?>',        '(?:',            $expr);
		$regexp->setJS('/(?:^|\\W)' . $expr . '(?!\\w)/gi');

		return $regexp;
	}
protected function getWordsRegexp(array $words)
	{
		$expr  = RegexpBuilder::fromList($words, $this->regexpOptions);
		$regexp = new Regexp('/(?<![\\pL\\pN])' . $expr . '(?![\\pL\\pN])/Siu');

		// JavaScript regexps don't support Unicode properties, so instead of Unicode letters
		// we'll accept any non-whitespace, non-common punctuation
		$expr = str_replace('[\\pL\\pN]', '[^\\s!-\\/:-?]', $expr);
		$expr = str_replace('(?>',        '(?:',            $expr);
		$regexp->setJS('/(?:^|\\W)' . $expr . '(?!\\w)/gi');

		return $regexp;
	}
protected function getWordsRegexp ( array $ words ) { $ expr = RegexpBuilder :: fromList ( $ words , $ this -> regexpOptions ) ; $ regexp = new Regexp ( '/(?<![\\pL\\pN])' . $ expr . '(?![\\pL\\pN])/Siu' ) ; // JavaScript regexps don't support Unicode properties, so instead of Unicode letters // we'll accept any non-whitespace, non-common punctuation $ expr = str_replace ( '[\\pL\\pN]' , '[^\\s!-\\/:-?]' , $ expr ) ; $ expr = str_replace ( '(?>' , '(?:' , $ expr ) ; $ regexp -> setJS ( '/(?:^|\\W)' . $ expr . '(?!\\w)/gi' ) ; return $ regexp ; }
Generate a regexp that matches the given list of words

@param  array   $words List of words
@return Regexp         Regexp instance with a Unicode-free JS variant
Generate a regexp that matches the given list of words