I have this function to check for banned words in my string. However, I cannot detect banned words if the spaces are removed - rendering the function useless. Can someone he
\b detects word boundaries, remove them to get a regular match.
\b
"/(" . implode("|", $badWords) . ")/i",