I've got this regular expression below which removes common whole words($commonWords
) from a string($input
) and I would like to tweak it so that
it ignores those words in double or single quotes (like exact search in google search tab)
it remove words starting with hyphen
('-')
but not those inside double or single quotes (like negative search in google search tab)return preg_replace('/\b('.implode('|',$commonWords).')\b/i','',$input);
thanks