<?php
$conditions = [
    'Community-acquired pneumonia',
    'Community-acquired pneumonia ',
    'CAP',
    'C:\\path\\test',
];
foreach ($conditions as $condition) {
    $quoted = preg_quote($condition, '/');
    $quoted = (string) preg_replace('/\s+/u', '\\s+', $quoted);
    $pat = '/\b' . $quoted . '\b/iu';
    $r = @preg_match($pat, 'Community-acquired pneumonia in stem');
    echo $condition, ' => err=', preg_last_error(), ' match=', var_export($r, true), PHP_EOL;
    if ($r === false) {
        echo '  pattern=', $pat, PHP_EOL;
    }
}
